public Creature(int maxLife, int attackSpeed, int speed, Vector position, double size) : base(position, size) { this.maxLife = maxLife; currentLife = maxLife; this.attackSpeed = attackSpeed; this.speed = speed; DamageObserver = new DamageObserver(); HealObserver = new HealObserver(); DeathObserver = new DeathObserver(); }
public void GetDamage(int damage) { currentLife -= damage; DamageObserver.NotifyAll(); if (currentLife <= 0) { DeathObserver.NotifyAll(); Destroy(); } }