Esempio n. 1
0
 private Vector3 FleePosition()
 {
     playerWitnessPosition = detectionScript.Target.position;
     closestGroupedAlly    = (from ally in FindObjectsOfType <EnemyRogue>()
                              where ally != this
                              orderby Vector3.Distance(ally.transform.position, transform.position)
                              select ally).DefaultIfEmpty(null).FirstOrDefault();
     GroupID = closestGroupedAlly.GroupID;
     return(closestGroupedAlly ? closestGroupedAlly.transform.position : Vector3.down);
 }
Esempio n. 2
0
 private void Flee()
 {
     animationScript.MovementRelativeSpeed = aI.speed = fleeingSpeed;
     if (!closestGroupedAlly)
     {
         Destination = FleePosition();
     }
     if (Destination != Vector3.down)
     {
         if (aI.remainingDistance < aI.stoppingDistance + stoppingThreshold && aI.remainingDistance > aI.stoppingDistance)
         {
             CreateTeam(playerWitnessPosition);
             closestGroupedAlly = null;
         }
     }
     else
     {
         currentState = EnemyState.Secondary;
     }
 }