Exemplo n.º 1
0
 private IEnumerator Move()
 {
     IsMoving = true;
     while (IsMoving)
     {
         if (FollowBase.Enabled && FollowBase.TargetPlanet != null)
         {
             if (!FollowBase.Arrived)
             {
                 FollowBase.Arrive();
             }
             else
             {
                 FollowBase.MoveAround();
             }
             LookWhereYoureGoing();
         }
         if (Separation.Enabled)
         {
             Separation.Separate();
         }
         if (Cohesion.Enabled)
         {
             Cohesion.Cohesie();
         }
         Velocity += Acceleration;
         Velocity *= MaxSpeed;
         //velocity = LimitVector(velocity, 5);
         Trans.position += (Vector3)Velocity * Time.deltaTime * 3;
         Acceleration   *= 0;
         if (Velocity.magnitude > 0)
         {
             Velocity /= 1.05f;
         }
         yield return(new WaitForSeconds(0.01f));
     }
 }