Пример #1
0
    private void OnEnergyStateChange(int _state)
    {
        if (fogueiraAnimator == null)
        {
            fogueiraAnimator = GameObject.FindGameObjectWithTag("Fogueira").GetComponent <Animator>();
        }

        if (catAnimator == null)
        {
            catAnimator = GameObject.FindGameObjectWithTag("Cat").GetComponent <Animator>();
        }

        if (girlAnimator == null)
        {
            girlAnimator = GameObject.FindGameObjectWithTag("Girl").GetComponent <Animator>();
        }

        fireZone = _state;
        if (_state == 2 && beatManager.levelConfigured && !beatManager.running)
        {
            beatManager.StartLevel();
        }

        switch (_state)
        {
        case 0:
            fogueiraAnimator.SetBool("started", false);
            break;

        case 1:
            fogueiraAnimator.SetBool("started", true);
            if (fogueiraAnimator.GetBool("boa"))
            {
                fogueiraAnimator.SetBool("boa", false);
            }
            break;

        case 2:
            fogueiraAnimator.SetBool("boa", true);
            if (fogueiraAnimator.GetBool("fogo"))
            {
                fogueiraAnimator.SetBool("fogo", false);
            }
            if (girlAnimator.GetBool("burnning"))
            {
                girlAnimator.SetBool("burnning", false);
            }
            break;

        case 3:
            //Debug.Log("vamos ver");
            fogueiraAnimator.SetBool("fogo", true);
            girlAnimator.SetBool("burnning", true);
            catAnimator.SetTrigger("burn");
            break;
        }
    }