public void SetUp() { currentHP = maxHP; currentShield = startingShield; behaviorStep = startingStep; preparedAction = behavior[behaviorStep]; if (preparedAction == PreparedAction.Attack) { RollDamage(); } EnemyUIUpdate?.Invoke(); }
public void TakeDamage(int damageTaken) { if (currentShield > 0) { int shld = currentShield; currentShield -= damageTaken; if (currentShield < 0) { int carryoverDamage = currentShield; currentHP += carryoverDamage; //any negative shield is carried over as HP damage DamageNumber?.Invoke(shld, DmgNumbers.shieldDamageColor); if (carryoverDamage != 0) { DamageNumber?.Invoke(-1 * carryoverDamage, DmgNumbers.damageColor); } currentShield = 0; } else { DamageNumber?.Invoke(damageTaken, DmgNumbers.shieldDamageColor); } } else { currentHP -= damageTaken; DamageNumber?.Invoke(damageTaken, DmgNumbers.damageColor); } if (currentHP <= 0) { HighScore highScore = FindObjectOfType <HighScore>(); highScore.IncreaseHighScore(); Die?.Invoke(); } EnemyUIUpdate?.Invoke(); }
public void Shield(Enemy target, int shieldAmount) //overload for shielding another enemy { target.currentShield += shieldAmount; EnemyUIUpdate?.Invoke(); }
public void Shield(int shieldAmount) { currentShield += shieldAmount; EnemyUIUpdate?.Invoke(); }