Exemplo n.º 1
0
 void Returning()
 {
     if (state == TankSate.Return)
     {
         if (timerReturnTime < returnTime)
         {
             float ratio = timerReturnTime / returnTime;
             transform.position = Vector3.Lerp(destination, startPosition, ratio);
             timerReturnTime   += Time.deltaTime;
         }
         else
         {
             transform.position = startPosition;
             state = TankSate.Stay;
         }
     }
 }
Exemplo n.º 2
0
 void Going()
 {
     if (state == TankSate.Go)
     {
         if (timerGoDelay > 0)
         {
             timerGoDelay -= Time.deltaTime;
         }
         else
         {
             distanceTraveled += speed * Time.deltaTime;
             float ratio = distanceTraveled / distanceToGo;
             //transform.position = localForwardVector * distanceTraveled;
             transform.position = Vector3.Lerp(startPosition, destination, ratio);
             if (distanceTraveled >= distanceToGo)
             {
                 transform.position = destination;
                 state           = TankSate.Return;
                 timerReturnTime = 0;
             }
         }
     }
 }
Exemplo n.º 3
0
 public void PlayerDetected()
 {
     state            = TankSate.Go;
     timerGoDelay     = goDelay;
     distanceTraveled = 0;
 }