Ejemplo n.º 1
0
 // Control game starting
 private void controlGameStarting()
 {
     // If the game is starting
     if (GameStateCheckers.isGameStarting(gameManagerRef.getCurrentGameState()))
     {
         // If the user presses the escape key
         // Start the game
         if (Input.GetKeyDown(KeyCode.Space))
         {
             gameManagerRef.startGame();
         }
     }
 }
Ejemplo n.º 2
0
    // Control look
    private void controlLook()
    {
        // If the current game state is active or starting
        if (GameStateCheckers.isGameActive(gameManagerRef.getCurrentGameState()) || GameStateCheckers.isGameStarting(gameManagerRef.getCurrentGameState()))
        {
            // Add to the rotation x and y values
            rotationX += Input.GetAxis("Mouse X") * lookSensitivity;
            rotationY += -Input.GetAxis("Mouse Y") * lookSensitivity;

            // Clamp the rotation values
            rotationX = Mathf.Clamp(rotationX, -90, 90);
            rotationY = Mathf.Clamp(rotationY, -90, 90);

            // Set the rotation of the player
            transform.eulerAngles = new Vector3(rotationY, rotationX, 0.0f);
        }
    }