Ejemplo n.º 1
0
        protected virtual void FreeMovement()
        {
            if (IsWaiting)
            {
                return;
            }
            if (target == null || TargetPosition == NullVector)
            {
                return;                                                 //If we have no were to go then Skip the code
            }
            RemainingDistance = target ? Vector3.Distance(animal.transform.position, target.position) : 0;

            var Direction = (target.position - animal.transform.position).normalized;

            animal.Move(Direction);

            // Debug.DrawRay(animal.transform.position, Direction.normalized, Color.white);

            if (RemainingDistance < StoppingDistance)   //We arrived to our destination
            {
                Arrive_Destination();
            }
        }