Ejemplo n.º 1
0
 public void ChaseOrRush(Unit target, float chaseRate, float rushRate)
 {
     if (target == null)
     {
         AddForce(Transform.TransformDirection(Vector3.forward) * rushRate, hasIgnoreFriction: true);
     }
     else
     {
         Transform.eulerAngles =
             Vector3.up * SetAngleToDestination(target.GetOrthographicPosition - GetOrthographicPosition);
         AddForce(GetNormDirectionToMove(target) *
                  MathVector.SqrDistance(GetPosition, target.GetPosition) *
                  chaseRate, hasIgnoreFriction: true, hasIgnoreMass: true);
     }
 }