Esempio n. 1
0
    /// <summary>
    /// Await player input. Returns true when valid input is received.
    /// </summary>
    private bool StateWaitingForPlayer()
    {
        if (Input.GetKey(KeyCode.W))
        {
            return(HandleMovement(Direction.S));
        }
        else if (Input.GetKey(KeyCode.A))
        {
            return(HandleMovement(Direction.W));
        }
        else if (Input.GetKey(KeyCode.S))
        {
            return(HandleMovement(Direction.N));
        }
        else if (Input.GetKey(KeyCode.D))
        {
            return(HandleMovement(Direction.E));
        }
        else if (Input.GetKeyUp(KeyCode.Q))
        {
            HandleRotation(RotateDirection.Left);
        }
        else if (Input.GetKeyUp(KeyCode.E))
        {
            HandleRotation(RotateDirection.Right);
        }
        else if (Input.GetKeyUp(KeyCode.F))
        {
            return(HandleInteraction());
        }
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            menuUI       = pauseMenu;
            currentState = MovementStates.PlayerInMenu;
            pauseMenu.SetActive(true);
        }
        else if (Input.GetKeyUp(KeyCode.P))
        {
            GameDataSerializer.SaveGame();
            Debug.Log("Game Saved!");
        }
        else if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            playerMovement.AcceptNextIndex(playerMovement.Index);
            currentState = MovementStates.MovingPlayer;
            return(true);
        }

        return(false);
    }
Esempio n. 2
0
 public void SaveGame()
 {
     GameDataSerializer.SaveGame();
     done = true;
 }