Exemple #1
0
    public void UpdateControlled()
    {
        if (playerUnity.gameManagerUnity.State == GameManagerUnity.GameManagerUnityState.GAME &&
            playerUnity.playerGUI.ActiveState == PlayerGUI.State.NORMAL)
        {
            if (firstUpdate)
            {
                rotationYaxis = playerUnity.player.rotation.y;
                rotationXaxis = playerUnity.player.rotation.x;
                firstUpdate   = false;
            }

            //TODO reset position and change camera menu
            if (Input.GetKeyDown(KeyCode.R))
            {
                playerUnity.player.ResetPosition();
            }

            if (Input.GetKeyDown(KeyCode.C))
            {
                playerUnity.ChangeCamera();
            }

            UpdateJump();
            UpdateMovement();
            UpdateCameraRotation();
            UpdateUserActions();
            UpdateItemOnHand();

            playerUnity.player.rotation.y = rotationYaxis;
            playerUnity.player.rotation.x = rotationXaxis;
        }
    }
    public void UpdateControlled()
    {
        if (playerUnity.gameManagerUnity.State == GameManagerUnity.GameManagerUnityState.GAME &&
            playerUnity.playerGUI.ActiveState == PlayerGUI.State.NORMAL)
        {
            if (Screen.lockCursor == false)
            {
                //Auto pause if the user leaves the game for some reason (ALT+TAB, etc..)
                playerUnity.gameManagerUnity.Pause();
            }
            else
            {
                if (firstUpdate)
                {
                    rotationYaxis = playerUnity.player.rotation.y;
                    rotationXaxis = playerUnity.player.rotation.x;
                    firstUpdate   = false;
                }

                if (Input.GetKeyDown(KeyCode.R))
                {
                    playerUnity.player.ResetPosition();
                }

                if (Input.GetKeyDown(KeyCode.C))
                {
                    playerUnity.ChangeCamera();
                }

                UpdateJump();
                UpdateMovement();
                UpdateCameraRotation();
                UpdateUserActions();
                UpdateItemOnHand();

                playerUnity.player.rotation.y = rotationYaxis;
                playerUnity.player.rotation.x = rotationXaxis;
            }
        }
    }