示例#1
0
 private void OnGameStateChanged(GameState state)
 {
     if (state == GameState.InGame)
     {
         _canMove = true;
     }
     else if (state == GameState.End)
     {
         _canMove = false;
         _animations.SetRunning(false);
     }
 }
 private void MoveToDestination()
 {
     if (DistanceToDestination() > minDistanceToDestination)
     {
         float step = moveSpeed * Time.deltaTime;
         transform.position = Vector3.MoveTowards(transform.position, _currentDestination, step);
         _animations.SetRunning(true);
     }
     else
     {
         _reachedDestination = true;
         _animations.SetRunning(false);
         OnReachedDestination?.Invoke(this);
     }
 }