示例#1
0
        /// <summary>Set the next Target</summary>
        public virtual void SetTarget(Transform target)
        {
            IsWaiting = false;
            animal.Mode_Interrupt();             //In Case it was making any Mode;
            Stopped     = false;
            this.target = target;

            // Debug.Log("targetPosition: " + targetPosition.ToString("F2"));

            if (target == null)
            {
                Stop();
            }
            else
            {
                TargetPosition = target.position;                           //Update the Target Position

                IsZone = target.GetComponent <Zone>();

                IsWayPoint   = target.GetComponent <MWayPoint>();
                NextWayPoint = target.GetComponent <IWayPoint>();            //Check if the Next Target has Next Waypoints



                StoppingDistance = DefaultStopDistance;                     //Reset the Stoppping Distance

                if (NextWayPoint != null)
                {
                    StoppingDistance = NextWayPoint.StoppingDistance;
                    NextTarget       = NextWayPoint.NextTarget;
                }
                // StoppingDistance = NextWayPoint != null ? NextWayPoint.StoppingDistance : DefaultStopDistance;  //Set the Next Stopping Distance

                CheckAirTarget();

                Debuging(name + ": is travelling to : " + target.name);

                ResumeAgent();
            }
        }