Пример #1
0
        public override void FixedUpdate()
        {
            base.FixedUpdate();

            if (!stunned && !destroyed)
            {
                if (!path.IsLinearPath())
                {
                    if (MoveToPoint(subPath[subWaypointID]))
                    {
                        subWaypointID += 1;
                        if (subWaypointID >= subPath.Count)
                        {
                            subWaypointID = 0;
                            waypointID   += 1;
                            if (waypointID >= path.GetPathWPCount())
                            {
                                ReachDestination();
                            }
                            else
                            {
                                subPath = path.GetWPSectionPath(waypointID);
                            }
                        }
                    }
                }
                else
                {
                    if (MoveToPoint(path.wpList[waypointID].position))
                    {
                        waypointID += 1;
                        if (waypointID >= path.wpList.Count)
                        {
                            ReachDestination();
                        }
                    }
                }
            }
        }
Пример #2
0
        void ReachDestination()
        {
            //Debug.Log("ReachDestination");

            if (destinationEffObj != null)
            {
                if (!autoDestroydestinationEff)
                {
                    ObjectPoolManager.Spawn(destinationEffObj, thisT.position, thisT.rotation);
                }
                else
                {
                    ObjectPoolManager.Spawn(destinationEffObj, thisT.position, thisT.rotation, destinationEffDuration);
                }
            }

            GameControl.OnCreepReachDestination(this);
            SpawnManager.OnCreepReachDestination(this);
            TDTK.OnCreepDestination(this);

            if (path.loop)
            {
                if (!path.IsLinearPath())
                {
                    //if(onDestinationE!=null) onDestinationE(this);
                    subWaypointID = 0;
                    waypointID    = path.GetLoopPoint();
                    SetSubPath(path.GetWPSectionPath(waypointID));
                }
                else
                {
                    waypointID = path.GetLoopPoint();
                }
                return;
            }

            destroyed = true;

            //if(onDestinationE!=null) onDestinationE(this);

            //float delay=0;
            //if(aniInstance!=null){ delay=aniInstance.PlayDestination(); }

            StartCoroutine(_ReachDestination(PlayAnimDestination()));
        }