public void Death()
 {
     pauseScript.PauseGame();
     GameObject[] targets = GameObject.FindGameObjectsWithTag("Target");
     foreach (GameObject target in targets)
     {
         GameObject.Destroy(target);
     }
     PauseMenu.SetActive(true);
     leftHandL.SetActive(true);
     rightHandL.SetActive(true);
     rightHand.SetActive(false);
     leftHand.SetActive(false);
 }
    void Update()
    {
        prevState = state;
        state     = GamePad.GetState(playerIndex);

        if (state.Triggers.Left >= 0.4)
        {
            canMove = false;
            LaserSightActivator();
            anim.SetBool("isCrouched", true);
        }
        else
        {
            canMove            = true;
            laserSight.enabled = false;
            anim.SetBool("isCrouched", false);
        }

        if (prevState.Buttons.LeftShoulder == ButtonState.Released && state.Buttons.LeftShoulder == ButtonState.Pressed)
        {
            if (grenadeCount > 0)
            {
                anim.SetTrigger("isGrenade");
                grenadeCount--;
                grenadeManager.GrenadeUsed(this);

                Instantiate(Grenade, transform.position + transform.forward * 2, transform.rotation);
            }
        }

        if (prevState.Buttons.Start == ButtonState.Released && state.Buttons.Start == ButtonState.Pressed)
        {
            if (Time.timeScale > 0)
            {
                pause.PauseGame();
            }
            else
            {
                pause.UnpauseGame();
            }
        }

        Move();
        float runValue = Mathf.Clamp(Mathf.Abs(rb.velocity.magnitude), 0, 1);

        anim.SetFloat("isRunning", rb.velocity.magnitude);
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && !isInTutorial && isChoiceMade)
        {
            pauseScript.PauseGame();
        }

        if (gameTimer >= gameDuration && !isFinished && !isInTutorial && isChoiceMade)
        {
            WinGame();
        }

        if (!isPaused && !isFinished)
        {
            UpdateTimer();
        }
    }
예제 #4
0
 public void PauseGame()
 {
     moving = false;
     dead   = false;
     pauseController.PauseGame();
 }