Exemplo n.º 1
0
    //Counts down time while game is playing. Tale damage if hits 0.
    void Update()
    {
        music = FindObjectOfType <MusicManager>();

        if (!list)
        {
            list = FindObjectOfType <equipmentList>();
        }


        //healthBar.value = currentHealth;

        if (Frozen > 0)
        {
            timerManager.sliderColour(Color.cyan);
            return;
        }


        if (Timer > greenZone)
        {
            music.AdjustPitch(-1);
            timerManager.sliderColour(Color.green);
        }
        else if (Timer < redZone)
        {
            music.AdjustPitch(2);
            timerManager.sliderColour(Color.red);
        }
        else
        {
            music.AdjustPitch(1);
            timerManager.sliderColour(Color.yellow);
        }

        if (manager.isPlaying() && (!transition || transition.transitionState == TransitionState.None) && (!storyManager || storyManager.phase == phases.None))
        {
            Timer -= Time.deltaTime;

            timerManager.SetTimeLeft(Timer);

            if (Timer < 0)
            {
                if (bossFighting)
                {
                    Debug.Log("Boss is Attacking Player");
                    parent.boss.EnemyAttack();
                }
                else
                {
                    enemy.EnemyAttack();
                }
            }
        }
    }