Guest User

Untitled

a guest
Dec 5th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function ComputeSightedPawns()
  2. {
  3.     local LegendsCitizenPawn PossibleTarget;
  4.     local float  DistanceToPossibleTarget, MaxAngle, CurrentEnemyAngle;
  5.     local Rotator CurrentPlayerRotation, EnemyPositionAngle;
  6.     local Vector normalisedVector;
  7.     local CurrentTargetStructure TempTarget;
  8.     local array< CurrentTargetStructure > Temp${1}< ${3} >
  9.     local int j;
  10.  
  11.     CurrentPlayerRotation = Pawn.Rotation;
  12.    
  13.     MaxDist = 600;
  14.     MaxAngle = 90;
  15.  
  16.     ForEach WorldInfo.AllActors(class'LegendsCitizenPawn', PossibleTarget)
  17.         {  
  18.             DistanceToPossibleTarget = vsize(PossibleTarget.location - Pawn.location);
  19.             normalisedVector = Normal(PossibleTarget.location - Pawn.location);
  20.             EnemyPositionAngle = Rotator(normalisedVector);
  21.  
  22.             if(DistanceToPossibleTarget <= MaxDist)
  23.             {
  24.                
  25.                 CurrentEnemyAngle = RDiff(CurrentPlayerRotation, EnemyPositionAngle);
  26.                 if(CurrentEnemyAngle <= MaxAngle)
  27.                 {
  28.                         TempTarget.TargetedPawn = PossibleTarget;
  29.                         TempArray.AddItem(TempTarget);
  30.                         j = TempArray.Find('TargetedPawn', PossibleTarget);
  31.                    
  32.                 }
  33.              
  34.             }
  35.  
  36.         }
  37.                     CurrentTargets = Temp${1}< ${3} >
  38.                     TempArray.Length = 0;
  39.                    
  40.        
  41.  
  42.  
  43. }
Add Comment
Please, Sign In to add comment