Ejemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            for (int i = 0; i < this.Count; i++)
            {
                if (this[i].position.X < (0 - this[i].texture.Width))
                {
                    this.Remove(this[i]);
                }
            }

            if (this.Count < this.enemyCap)
            {
                this.CreateEnemy(gameTime);
            }

            for (int i = 0; i < this.Count; i++)
            {
                if (GUtility.OfTypeBoss(this[i]))
                {
                    if (this[i].healthPoints <= 0)
                    {
                        this.Remove(this[i]);
                    }
                }

                this[i].Update(gameTime);
            }

            this.BossManager(gameTime);

            this.DifficultyIncrement(gameTime);
        }
Ejemplo n.º 2
0
        private void CollisionChecker()
        {
            for (int i = 0; i < this.enemyManager.Count; i++)
            {
                for (int j = 0; j < this.Count; j++)
                {
                    if (this[j].hitbox.Intersects(this.enemyManager[i].hitbox) && !GUtility.OfTypeBoss(this.enemyManager[i]))
                    {
                        this.enemyManager.Remove(this.enemyManager[i]);
                        this.Remove(this[j]);
                        this.caster.frags++;
                        this.enemyManager.fragsUntilBoss--;
                        break;
                    }

                    if (this[j].hitbox.Intersects(this.enemyManager[i].hitbox))
                    {
                        this.enemyManager[i].healthPoints -= 10;
                        this.Remove(this[j]);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        } // Draws ship on the screen

        private void Collision()
        {
            switch (this.health)
            {
            case 3:
                this.currentTexture = this.textures[0];
                break;

            case 2:
                this.currentTexture = this.textures[1];
                break;

            case 1:
                this.currentTexture = this.textures[2];
                break;

            default:
                this.game.ResetGame();
                break;
            }

            for (int i = 0; i < this.game.enemyManager.Count; i++)
            {
                if (this.hitbox.Intersects(this.game.enemyManager[i].hitbox))
                {
                    if (GUtility.OfTypeBoss(this.game.enemyManager[i]))
                    {
                        this.health -= this.health;
                        break;
                    }

                    this.health--;
                    this.game.enemyManager.Remove(this.game.enemyManager[i]);
                }
            }
        } // Loops through the enemy manager and checks if the player collides with an enemy.