Exemple #1
0
        public virtual void Explode()
        {
            ZombieShip zombie = this as ZombieShip;

            if (zombie != null)
            {
                if (zombie.type == ZombieType.FLOATER)
                {
                    this.Screen.AddComponent(new ZombieExplosion(this.Game, this.Screen, Vector2.Add(this.Position, new Vector2(0, 38))));
                }
                else if (zombie.type == ZombieType.CANNON)
                {
                    this.Screen.AddComponent(new ZombieExplosion(this.Game, this.Screen, Vector2.Add(this.Position, new Vector2(0, 0))));
                }
                else
                {
                    AudioManager.playSoundEffect(shipExplosion);
                    this.Screen.AddComponent(new Explosion(this.Game, this.Screen, Vector2.Add(this.Position, new Vector2(-10, -10))));
                }
            }
            else
            {
                AudioManager.playSoundEffect(shipExplosion);
                this.Screen.AddComponent(new Explosion(this.Game, this.Screen, Vector2.Add(this.Position, new Vector2(-10, -10))));
            }
            this.Destroy();
        }
Exemple #2
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            bulletAnimation.Update(gameTime);

            foreach (GameComponent component in this.Screen.Components)
            {
                GameJamComponent drawable = component as GameJamComponent;
                if (drawable != null && this.Collide(drawable))
                {
                    if (drawable is Asteroid)
                    {
                        this.Destroy();
                    }

                    if (team == Team.PLAYER)
                    {
                        ZombieShip zombie = drawable as ZombieShip;
                        if (zombie != null)
                        {
                            this.Destroy();
                            zombie.Explode();
                            long points = zombie.PointValue * ((2 * this.Screen.GameSpeed) - 10);
                            this.Screen.Player.ScorePoints(points);
                            this.Screen.AddComponent(new ScoreDisplay(this.Game, this.Screen, zombie.Position, points));
                        }

                        Boss boss = drawable as Boss;
                        if (boss != null && boss.Alive)
                        {
                            this.Destroy();
                            boss.Damage();
                        }
                    }
                }
            }
        }