コード例 #1
0
 void Start()
 {
     if (breakTimer == null)
     {
         breakTimer = GetComponentInChildren <ComplexTimer>();
     }
     breakTimer.JumpToStart();
     breakTimer.Pause();
 }
コード例 #2
0
        public void OnReachedWaypoint()
        {
            waitTimer.Pause();
            waitTimer.JumpToStart();
            if (backTracking)
            {
                currentWaypoint--;
            }
            else
            {
                currentWaypoint++;
            }
            switch (moveType)
            {
            case MoveType.Once:
                if (currentWaypoint == wayPoints.Count)
                {
                    hasTraveledFullCycle = true;
                    currentWaypoint      = wayPoints.Count - 1;
                }
                else if (currentWaypoint == -1)
                {
                    hasTraveledFullCycle = true;
                    currentWaypoint      = 0;
                }
                return;

            case MoveType.Loop:
                if (currentWaypoint == wayPoints.Count)
                {
                    currentWaypoint = 0;
                }
                else if (currentWaypoint == -1)
                {
                    currentWaypoint = wayPoints.Count - 1;
                }
                return;

            case MoveType.PingPong:
                if (currentWaypoint == wayPoints.Count)
                {
                    currentWaypoint     -= 2;
                    backTracking         = !backTracking;
                    hasTraveledFullCycle = true;
                }
                else if (currentWaypoint == -1)
                {
                    currentWaypoint     += 2;
                    backTracking         = !backTracking;
                    hasTraveledFullCycle = true;
                }
                return;
            }
        }