Esempio n. 1
0
        public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2))
        {
            if (texture != null)
            {
                if (visible)
                {
                    draw_offset -= draw_vector();
                    sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    // Name section
                    foreach (HUD_Component component in Name_Components)
                    {
                        component.draw(sprite_batch, texture, -1 * (Name_Loc - draw_offset));
                    }
                    foreach (TextSprite name in Names)
                    {
                        name.draw(sprite_batch, -1 * (Name_Loc - draw_offset));
                    }
                    // Main section
                    foreach (HUD_Component component in Components)
                    {
                        component.draw(sprite_batch, texture, -1 * (Base_Loc - draw_offset));
                    }
                    sprite_batch.End();
                    // Faces
                    foreach (Battle_Face_Sprite face in Faces)
                    {
                        face.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    }

                    sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    // Stat BG
                    foreach (Battle_Stats_BG bg in Stat_BGs)
                    {
                        bg.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    }
                    // Stats
                    foreach (RightAdjustedText stat in Stat_Imgs)
                    {
                        stat.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    }
                    sprite_batch.End();
                    // Weapon Icons
                    foreach (Item_Icon_Sprite icon in Weapon_Icons)
                    {
                        icon.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    }
                    sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
                    // Weapon Names
                    foreach (TextSprite name in Weapon_Names)
                    {
                        name.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    }
                    // Weapon Triangle Arrows
                    foreach (Weapon_Triangle_Arrow wta in WTAs)
                    {
                        wta.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    }
                    // Attack Multipliers
                    foreach (Multiplier_Img mult in Mults)
                    {
                        mult.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    }

                    HP_Gauge_1.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    HP_Count_1.draw(sprite_batch, -1 * (Base_Loc - draw_offset));
                    if (HP_Gauge_2 != null)
                    {
                        HP_Gauge_2.draw(sprite_batch, (-1 * Base_Loc) + draw_offset);
                        HP_Count_2.draw(sprite_batch, (-1 * Base_Loc) + draw_offset);
                    }
                    sprite_batch.End();
                }
            }
        }
Esempio n. 2
0
 public override void update()
 {
     if (!is_ready) //Yeti
     {
         move(Y_Move.pop());
     }
     // skill opacity //Yeti
     // Weapon icon flash //Yeti
     foreach (Item_Icon_Sprite icon in Weapon_Icons)
     {
         icon.update();
     }
     foreach (Multiplier_Img mult in Mults)
     {
         mult.update();
     }
     foreach (Weapon_Triangle_Arrow wta in WTAs)
     {
         wta.update();
     }
     HP_Gauge_1.update();
     HP_Gauge_1.hp = Hp1;
     HP_Count_1.update();
     HP_Count_1.set_hp(Hp1);
     if (HP_Gauge_2 != null)
     {
         HP_Gauge_2.update();
         HP_Gauge_2.hp = Hp2;
         HP_Count_2.update();
         HP_Count_2.set_hp(Hp2);
     }
     // Update HP gauges
     if (No_Hp1_Timer > 0)
     {
         No_Hp1_Timer--;
     }
     if (No_Hp2_Timer > 0)
     {
         No_Hp2_Timer--;
     }
     if (No_Health_Timer > 0)
     {
         No_Health_Timer--;
     }
     if (Hp1_Timer == 0)
     {
         // HP gain: battler 1
         if (Hp1 < data_hp1)
         {
             Hp_Gain = 1;
             Hp1++;
             Hp1_Timer = 4;
         }
         // HP loss: battler 1
         else if (Hp1 > data_hp1)
         {
             if (data_hp1 <= 0 && !No_Health_Flag)
             {
                 No_Health_Flag  = true;
                 No_Health_Timer = 29; // Effectively 30
             }
             Hp1--;
             if (Hp1 <= 0)
             {
                 No_Hp1_Timer = No_Health_Timer;
             }
             Hp1_Timer = 2;
         }
     }
     else if (Hp_Gain == 1 && Hp1_Timer == 2)
     {
         Global.game_system.play_se(System_Sounds.HP_Recovery);
         Hp_Gain = 0;
     }
     if (battler_2 != null)
     {
         if (Hp2_Timer == 0)
         {
             // HP gain: battler 2
             if (Hp2 < data_hp2)
             {
                 Hp_Gain = 2;
                 Hp2++;
                 Hp2_Timer = 4;
             }
             // HP loss: battler 2
             else if (Hp2 > data_hp2)
             {
                 if (data_hp2 <= 0 && !No_Health_Flag)
                 {
                     No_Health_Flag  = true;
                     No_Health_Timer = 29; // Effectively 30
                 }
                 Hp2--;
                 if (Hp2 <= 0)
                 {
                     No_Hp2_Timer = No_Health_Timer;
                 }
                 Hp2_Timer = 2;
             }
         }
         else if (Hp_Gain == 2 && Hp2_Timer == 2)
         {
             Global.game_system.play_se(System_Sounds.HP_Recovery);
             Hp_Gain = 0;
         }
     }
     // Update stats
     if (!stat_update_done())
     {
         if (Stat_Timer == 0)
         {
             update_stats();
             refresh_battle_stats(true);
             Stat_Timer = 2;
         }
     }
     // update messages //Yeti
     if (Hp1_Timer > 0)
     {
         Hp1_Timer--;
     }
     if (Hp2_Timer > 0)
     {
         Hp2_Timer--;
     }
     if (Stat_Timer > 0)
     {
         Stat_Timer--;
     }
     if (Hit_Wait_Timer > 0)
     {
         Hit_Wait_Timer--;
         if (Hit_Wait_Timer == 0)
         {
             Health_Loss = 0;
         }
     }
     foreach (Battle_Face_Sprite face in Faces)
     {
         face.update();
     }
 }