Exemplo n.º 1
0
    public void ShowAttackChangeHP(bool left, SpriteRenderer sr, int max, int src, int dest, int speed, float waitTime, UnityAction onComplete = null)
    {
        UI_BattleAttackInfo ui = left ? Left_BattleAttackInfo : Right_BattleAttackInfo;

        gameMode.unitShower.SetHP(sr, max, src, dest, ConstTable.UI_VALUE_BAR_SPEED());
        ui.SetHP(max, src, dest, ConstTable.UI_VALUE_BAR_SPEED(), waitTime, onComplete);
    }
Exemplo n.º 2
0
 private void HP()
 {
     if (AttackInfo.damageToAttack > 0)
     {
         int maxHP1  = atk.Logic.GetMaxHP();
         int srcHp1  = atk.Logic.GetCurrentHP();
         int destHP1 = atk.Logic.Damage(AttackInfo.damageToAttack);
         if (destHP1 == 0)
         {
             gameMode.UIManager.ShowAttackChangeHP(!IsLeft, defSr, maxHP1, srcHp1, destHP1, ConstTable.UI_VALUE_BAR_SPEED(), WaitTime, null);
         }
         else
         {
             gameMode.UIManager.ShowAttackChangeHP(!IsLeft, defSr, maxHP1, srcHp1, destHP1, ConstTable.UI_VALUE_BAR_SPEED(), WaitTime, null);
         }
     }
     if (AttackInfo.hit)
     {
         int maxHP  = def.Logic.GetMaxHP();
         int srcHP  = def.Logic.GetCurrentHP();
         int destHP = def.Logic.Damage(AttackInfo.damageToDefender);
         if (destHP == 0)
         {
             gameMode.UIManager.ShowAttackChangeHP(IsLeft, atkSr, maxHP, srcHP, destHP, ConstTable.UI_VALUE_BAR_SPEED(), WaitTime, () => Dead(def));
         }
         else
         {
             gameMode.UIManager.ShowAttackChangeHP(IsLeft, atkSr, maxHP, srcHP, destHP, ConstTable.UI_VALUE_BAR_SPEED(), WaitTime, Continue);
         }
         AttackInfo.damageToAttack = 10;
     }
     else
     {
         //miss
         Avoid();
     }
 }