Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public void GetDamage(int damage)
        {
            currentLife -= damage;

            DamageObserver.NotifyAll();

            if (currentLife <= 0)
            {
                DeathObserver.NotifyAll();
                Destroy();
            }
        }