Ejemplo n.º 1
0
        private void handleBulletCollision(Bullet i_Bullet)
        {
            PlayerSpaceInvaders player = SpaceInvadersServices.GetPlayerComponent(this.Game, SerialNumber);

            if (player != null)
            {
                player.LoseLife();
                int remainingPlayerLifes = player.Lifes;
                this.Position = new Vector2(0, this.Position.Y);
                if (remainingPlayerLifes == 0)
                {
                    this.isDying = true;
                    LastAnimation();
                }
                else
                {
                    this.Position = new Vector2(0, this.Position.Y);
                    this.Animations["BlinkAnimator"].Reset();
                    this.Animations["BlinkAnimator"].Resume();
                }

                this.GameScreen.Remove(i_Bullet);
                i_Bullet.Dispose();
            }
        }
Ejemplo n.º 2
0
 public ConfSpaceShip(PlayerSpaceInvaders.eSpaceShipType i_SpaceShipType, Keys i_KeyMoveLeft, Keys i_KeyMoveRight, Keys i_KeysShoot, bool i_IsMouseMovementEnable)
 {
     SpaceShipType = i_SpaceShipType;
     KeyMoveLeft = i_KeyMoveLeft;
     KeyMoveRight = i_KeyMoveRight;
     KeysShoot = new Keys[] { i_KeysShoot };
     IsMouseMovementEnable = i_IsMouseMovementEnable;
 }
Ejemplo n.º 3
0
        public override void Collided(ICollidable i_Collidable)
        {
            Bullet bullet = i_Collidable as Bullet;

            if (bullet != null && !this.isDying)
            {
                this.Velocity = new Vector2(0);
                isDying       = true;
                m_SoundWhenKilled.Play();
                LastAnimation();
                PlayerSpaceInvaders player = SpaceInvadersServices.GetPlayerComponent(this.Game, bullet.GunSerialNumber);
                if (player != null)
                {
                    player.AddScore(Points);
                }

                this.GameScreen.Remove(bullet);
                bullet.Dispose();
            }
        }