public void TakeDamage(ShellInfo shell)
        {
            int damage = shell.Damage;

            if (shell.Effect != null)
            {
                shell.Effect(battleStats);
            }
            int startedHealth = battleStats.CurrentHealth;

            battleStats.Solidity.Attack(damage);
            int deltaHealth = startedHealth - battleStats.CurrentHealth;

            if (deltaHealth != 0)
            {
                if (OnDamage != null)
                {
                    OnDamage(deltaHealth);
                }
            }
            if (!battleStats.Solidity.IsAlive())
            {
                if (OnDeath != null)
                {
                    OnDeath();
                }
            }
        }
Exemplo n.º 2
0
 public EnemyBattleStats(Solidity solidity, float velocity, ShellInfo shell) : base(solidity)
 {
     Velocity = velocity;
     Shell    = shell;
 }