예제 #1
0
    private void UpdateHealth(int health)
    {
        switch (health)
        {
        case 0:
            Hp1.SetActive(false);
            break;

        case 1:
            Hp2.SetActive(false);
            break;

        case 2:
            Hp3.SetActive(false);
            break;

        case 3:
            Hp4.SetActive(false);
            break;

        case 4:
            Hp5.SetActive(false);
            break;


        default:
            break;
        }
    }
예제 #2
0
        public override void update()
        {
            if (Window_Shake.Count > 0)
            {
                Window_Offset = Window_Shake.shift();
            }
            if (Data_Shake.Count > 0)
            {
                Data_Offset = Data_Shake.shift();
            }

            if (Timer < TIMER_MAX)
            {
                Timer++;
            }

            if (Hp1 != this.hp1 || (unit_2 != null && Hp2 != this.hp2))
            {
                if (Global.Input.triggered(Inputs.A) ||
                    Global.Input.mouse_triggered(MouseButtons.Left) ||
                    Global.Input.gesture_triggered(TouchGestures.Tap))
                {
                    if (Hp1 < this.hp1 || (unit_2 != null && Hp2 < this.hp2))
                    {
                        Global.game_system.play_se(System_Sounds.HP_Recovery);
                    }
                    Hp1 = this.hp1;
                    if (unit_2 != null)
                    {
                        Hp2 = this.hp2;
                    }
                }
            }

            if (Hp1_Timer == 0)
            {
                if (Hp1 < hp1)
                {
                    Global.game_system.play_se(System_Sounds.HP_Recovery);
                    Hp1_Timer = HP_GAIN_TIME;
                }
                Hp1 = Additional_Math.int_closer(Hp1, hp1, 1);
            }
            if (unit_2 != null && Hp2_Timer == 0)
            {
                if (Hp2 < hp2)
                {
                    Global.game_system.play_se(System_Sounds.HP_Recovery);
                    Hp2_Timer = HP_GAIN_TIME;
                }
                Hp2 = Additional_Math.int_closer(Hp2, hp2, 1);
            }
            if (Hp1_Timer > 0)
            {
                Hp1_Timer--;
            }
            if (Hp2_Timer > 0)
            {
                Hp2_Timer--;
            }
            Name1.update();
            HP_Counter1.text = (Hp1 > 99 ? "??" : Hp1.ToString());
            HP_Counter1.update();
            if (unit_2 != null)
            {
                Name2.update();
                HP_Counter2.text = (Hp2 > 99 ? "??" : Hp2.ToString());
                HP_Counter2.update();
            }
            // Update stats
            if (!stat_update_done())
            {
                if (Stat_Timer == 0)
                {
                    update_stats();
                    refresh_battle_stats();
                    Stat_Timer = 2;
                }
            }
            if (Stat_Timer > 0)
            {
                Stat_Timer--;
            }
            foreach (RightAdjustedText text in Stat_Imgs)
            {
                text.update();
            }
        }