Beispiel #1
0
    private void Update()
    {
        //Controles dentro del juego
        if (!gameManager.instance.IsPaused)
        {
            changeAxis();
            if (Rigid.velocity.magnitude > 0f)
            {
                if (!Aud.isPlaying)
                {
                    Aud.Play();
                }
            }
            else
            {
                Aud.Stop();
            }

            //interactua con objeto
            if (Input.GetButtonDown("Fire1") && interactionTarget != null)
            {
                gameManager.instance.IsPaused = true;
                gameManager.instance.InScene  = true;
                interactionTarget.nextDialogue();
            }
            else if (Input.GetButtonDown("Fire1") && !isAttacking)
            {
                StartCoroutine(attack(1));
            }

            if (Input.GetButtonDown("Cancel"))
            {
                if (!gameManager.instance.InScene)
                {
                    pauseGame();
                }
            }
        }
        //controles de escena
        else if (gameManager.instance.InScene)
        {
            if (Input.GetButtonDown("Fire1"))
            {
                interactionTarget.nextDialogue();
            }
            if (Input.GetButtonDown("Cancel"))
            {
                interactionTarget.endConversation();
            }
        }
        //Controles de pausa
        else if (Input.GetButtonDown("Cancel"))
        {
            if (!gameManager.instance.InScene)
            {
                pauseGame();
            }
        }

        if (Health <= 0)
        {
            SceneManager.LoadScene(0);
        }
    }