コード例 #1
0
ファイル: UnitCreep.cs プロジェクト: wattson-coder/TD
        void ReachDestination()
        {
            if (path.loop)
            {
                if (onDestinationE != null)
                {
                    onDestinationE(this);
                }
                subWaypointID = 0;
                waypointID    = path.GetLoopPoint();
                subPath       = path.GetWPSectionPath(waypointID);
                return;
            }

            dead = true;

            if (onDestinationE != null)
            {
                onDestinationE(this);
            }

            float delay = 0;

            StartCoroutine(_ReachDestination(delay));
        }
コード例 #2
0
 //flag passed indicate initial reset, only true in the first call
 void Reset(bool initial = false)
 {
     //if use path-looping, use loop point otherwise use the starting point
     if (path.loop && !initial)
     {
         waypointID = path.GetLoopPoint();
     }
     else
     {
         waypointID = 1;
     }
     subWaypointID = 0;
     subPath       = path.GetWPSectionPath(waypointID);
     //only reset position if not using path-looping or it's the initial reset
     if (!path.loop || initial)
     {
         indicatorT.position = path.GetSpawnPoint().position;
     }
 }