public int Attack(BattlerType t, iBattleable target) { int totalDamage = 0; if (t == BattlerType.Instigator) { totalDamage = _instigatorBattlers.Sum(x => x.GetStrength()); Audio.AudioInstance.PlaySFX(_instigatorBattlers[0].GetAttackSound()); } else { totalDamage = _oppositionBattler.GetStrength(); Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound()); } target.ReduceHP(totalDamage); OnBattleAbleTakeDamage(target, totalDamage); OnBattleAbleUpdate(target); if (target.IsKO()) { Audio.AudioInstance.PlaySFX(target.GetDeathSound()); } else { Audio.AudioInstance.PlaySFX(target.GetHitSound()); } Debug.Log(t + " attacked " + target.GetType() + " for " + totalDamage + " damage."); Debug.Log(target.GetCurrentHP() + " hp left (" + target.GetHPPercentage() * 100 + "%)"); return(totalDamage); }
void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject) { if (_healthBarSliders.ContainsKey(battleAbleObject.GetUniqueID())) { _healthBarSliders[battleAbleObject.GetUniqueID()].value = battleAbleObject.GetHPPercentage(); } }
public int Attack(BattlerType t, iBattleable target) { int totalDamage = 0; if (t == BattlerType.Instigator) { totalDamage = _instigatorBattlers.Sum(x => x.GetStrength()); Audio.AudioInstance.PlaySFX(_instigatorBattlers[0].GetAttackSound()); } else { totalDamage = _oppositionBattler.GetStrength(); Audio.AudioInstance.PlaySFX(_oppositionBattler.GetAttackSound()); } target.ReduceHP(totalDamage); OnBattleAbleTakeDamage (target, totalDamage); OnBattleAbleUpdate (target); if (target.IsKO()) { Audio.AudioInstance.PlaySFX(target.GetDeathSound()); } else { Audio.AudioInstance.PlaySFX(target.GetHitSound()); } Debug.Log(t + " attacked " + target.GetType() + " for " + totalDamage + " damage."); Debug.Log(target.GetCurrentHP() + " hp left (" + target.GetHPPercentage()*100 + "%)"); return totalDamage; }
void BattleManager_OnBattleAbleUpdate(iBattleable battleAbleObject) { if(_healthBarSliders.ContainsKey(battleAbleObject.GetUniqueID())) _healthBarSliders[battleAbleObject.GetUniqueID()].value = battleAbleObject.GetHPPercentage(); }