Example #1
0
    // Update is called once per frame
    void Update()
    {
        Vector2 inputAxis = Vector2.zero;

        //Pause
        if (hud.paused || hud.winLose)
        {
            mouse.Show();
            inputAxis.x = 0;
            inputAxis.y = 0;
            lookRotation.SetMouseAxis(Vector2.zero);

            PC.SetAxis(inputAxis);
            if (hud.paused)
            {
                if (Input.GetKeyDown(KeyCode.P))
                {
                    hud.ClosePausePanel();
                }
            }
        }
        else
        {
            mouse.Hide();
            if (Input.GetKeyDown(KeyCode.P))
            {
                hud.OpenPausePanel();
            }
            //Player


            inputAxis.x = Input.GetAxis("Horizontal");
            inputAxis.y = Input.GetAxis("Vertical");

            PC.SetAxis(inputAxis);
            //Jump

            /* if(Input.GetButton("Jump"))
             * {
             *   PC.StartJump();
             * }*/

            //Mouse
            Vector2 mouseAxis = Vector2.zero;
            mouseAxis.x = Input.GetAxis("Mouse X") * sensitivity;
            mouseAxis.y = Input.GetAxis("Mouse Y") * sensitivity; //Recogemos el Y para mover el X de la camara;
            lookRotation.SetMouseAxis(mouseAxis);

            if (Input.GetMouseButtonDown(0))
            {
                mouse.Hide();
            }
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                mouse.Hide();
            }


            //DISPARO
            if (Input.GetButton("Fire1"))
            {
                PC.TryShot();
            }


            if (Input.GetMouseButtonDown(0))
            {
                mouse.Hide();
            }
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                mouse.Show();
            }
        }
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.P))
        {
            if (gameManager.gamePaused)
            {
                gameManager.Resume();
            }
            else
            {
                gameManager.Pause();
            }
        }

        if (gameManager.gamePaused)
        {
            return;
        }

        //Player Movement
        Vector2 inputAxis = Vector2.zero;

        inputAxis.x = Input.GetAxis("Horizontal");
        inputAxis.y = Input.GetAxis("Vertical");
        playerController.SetAxis(inputAxis);
        //Player Jump
        if (Input.GetButton("Jump"))
        {
            playerController.StartJump();
        }

        //Read Mouse axis
        Vector2 mouseAxis = Vector2.zero;

        mouseAxis.x = Input.GetAxis("Mouse X") * sensitivity;
        mouseAxis.y = Input.GetAxis("Mouse Y") * sensitivity;
        lookRotation.SetMouseAxis(mouseAxis);



        //Shooting
        //if(Input.GetButton("Fire1")) playerController.TryShot();
        //if(Input.GetKeyDown(KeyCode.R)) playerController.TryReload();

        if (Input.GetMouseButtonDown(0))
        {
            mouse.Hide();
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            mouse.Show();                                  //Without this you're legit f****d.
        }
        //if(Input.GetKeyDown(KeyCode.B)) playerController.Damage(10);

        if (Input.GetKeyDown(KeyCode.X))
        {
            playerController.Whistle();
        }
        if (cutscene.sendHasBeenEntered && !cutscene.dogsSent)
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                playerController.SendDogs();
                cutscene.dogsSent = true;
                Debug.Log("Sent");
            }
        }
    }