Ejemplo n.º 1
0
        private void Update()
        {
            switch (gameState)
            {
            case GameState.None:
                break;

            case GameState.PlayerTurn:
                if (_inputActions.Player.enabled && !_player.isMoving)
                {
                    var playerAction = InterpretPlayerAction();

                    if (playerAction == PlayerAction.DropCoin)
                    {
                        DropCoin(_player.transform.position.x, _player.transform.position.y);
                    }
                    else if (playerAction == PlayerAction.Escape)
                    {
                        Destroy(_player.gameObject);
                        winText.text = "You escaped";
                        StartCoroutine(EndGame());
                    }
                    else
                    {
                        _player.RegisterAction(playerAction);
                    }
                }
                break;

            case GameState.EnemyTurn:
                if (CheckForEnemies())
                {
                    EnemyTurn();
                }
                EnablePlayerInput();
                gameState = GameState.PlayerTurn;
                break;

            case GameState.TurnInProgress:
                break;

            default:
                break;
            }
        }