Esempio n. 1
0
 internal void Damaged()
 {
     if (Health <= 0)
     {
         if (HealthBar.CurrentSize.Height != 0)
         {
             HealthBar.SetCurrent(Health, MaxHealth);
         }
     }
     else
     {
         HealthBar.SetCurrent(Health, MaxHealth);
     }
 }
Esempio n. 2
0
        internal void Update()
        {
            //Work out how long since we were last here in seconds
            gameTime = _timer.ElapsedMilliseconds / 1000.0;
            double elapsedTime = gameTime - _lastTime;

            _lastTime = gameTime;

            //Updates all the game objects
            foreach (GameObject gameObject in GameObjects)
            {
                gameObject.Update(gameTime, elapsedTime);
            }

            //Deletes objects marked for deletion
            foreach (GameObject gameObject in ObjectsMarkedForDeletion)
            {
                GameObjects.Remove(gameObject);
            }

            //Update Mana Bar
            if (elapsedTime != 0)
            {
                if (currentMana + (float)(manaRegen * elapsedTime) <= maxMana)
                {
                    currentMana += (float)(manaRegen * elapsedTime);
                }
                else
                {
                    currentMana = maxMana;
                }
            }

            manaBar.SetCurrent((int)currentMana, (int)maxMana);

            //Increase Round Number
            if (60 - (int)gameTime % 60 != roundTimer)
            {
                roundTimer -= 1;
            }
            if (roundTimer == 0)
            {
                roundTimer   = 60;
                RoundNumber += 1;
            }

            //Check to see if an enemy should be spawned
            SpawnEnemies(gameTime);
        }
Esempio n. 3
0
        internal override void Update(double gameTime, double elapsedTime)
        {
            this.HealthBar.Velocity = this.Velocity;

            if (Health <= 0)
            {
                this.Destroy();
            }
            else
            {
                HealthBar.SetCurrent(Health, MaxHealth);
            }

            base.Update(gameTime, elapsedTime);
        }