Пример #1
0
    void FixedUpdate()
    {
        isMoving    = false;
        isExhausted = false;

        if (exhaustionBar.maxExhaustion())
        {
            isExhausted = !isExhausted;
            moveSpeed   = 0;
            anim.SetBool("isExhausted", true);
        }
        else
        {
            anim.SetBool("isExhausted", false);
        }

        if (Input.GetKey(KeyCode.A))           // && !isExhausted) {
        {
            Move(Direction.Left);
            gameObject.transform.rotation = new Quaternion(0, 0, 0, 0);
            isMoving = !isMoving;
        }
        if (Input.GetKey(KeyCode.D))            //&& !isExhausted) {
        {
            Move(Direction.Right);
            gameObject.transform.rotation = new Quaternion(0, 180, 0, 0);
            isMoving = !isMoving;
        }

        if (exhaustionBar.overHalfExhaustion())
        {
            anim.SetBool("isTired", true);
        }
        else
        {
            anim.SetBool("isTired", false);
        }

        if (isMoving)
        {
            anim.SetBool("isMoving", true);
            if (!AudioManager.instance.IsPlaying(Sound.Footsteps))
            {
                AudioManager.instance.PlaySoundLoop(Sound.Footsteps);
            }
        }
        else
        {
            anim.SetBool("isMoving", false);
            if (AudioManager.instance.IsPlaying(Sound.Footsteps))
            {
                AudioManager.instance.EndSoundAbrupt(Sound.Footsteps);
            }
        }
    }
Пример #2
0
    void Update()
    {
        if (ExhaustionBar.maxExhaustion())
        {
            GameOver();
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (GamePaused)
            {
                Resume();
            }
            else
            {
                PauseGame();
            }
        }
    }