示例#1
0
        public void InitWallsForNextLevel()
        {
            if (this.m_GameEngine == null)
            {
                this.m_GameEngine = this.Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
            }

            this.initWallsPositions();
            foreach (Wall wall in this.m_Walls)
            {
                wall.Pixels = (Color[])wall.OriginalPixels.Clone();
                if (wall.CurrTexture != null)
                {
                    wall.CurrTexture.SetData(wall.Pixels);
                }

                if (SpaceInvadersConfig.s_LogicLevel == SpaceInvadersConfig.eLevel.Two)
                {
                    wall.Velocity = new Vector2(45, 0);
                }

                if (SpaceInvadersConfig.s_LogicLevel != SpaceInvadersConfig.eLevel.One &&
                    SpaceInvadersConfig.s_LogicLevel != SpaceInvadersConfig.eLevel.Two)
                {
                    wall.Velocity += new Vector2(SpaceInvadersConfig.k_WallsVelocitiyAdditionPercent * wall.Velocity.X, 0);
                }
            }
        }
示例#2
0
 public Wall(GameScreen i_GameScreen)
     : base(k_AssteName, i_GameScreen)
 {
     if (this.m_GameEngine == null)
     {
         this.m_GameEngine = Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
     }
 }
示例#3
0
        private void numOfPlayers_Changed(object sender, EventArgs args)
        {
            if (this.m_GameEngine == null)
            {
                this.m_GameEngine = this.Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
            }

            this.m_GameEngine.ChangeNumOfPlayers(this.m_ScreensManager.GetScreen("PlayScreen"));
        }
示例#4
0
        void ICollidable.Collided(ICollidable i_Collidable)
        {
            if (this.m_GameEngine == null)
            {
                this.m_GameEngine = Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
            }

            this.m_GameEngine.HandleHit(this, i_Collidable);
        }
示例#5
0
        void ICollidable.Collided(ICollidable i_Collidable)
        {
            if (this.m_GameEngine == null)
            {
                this.m_GameEngine = this.Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
            }

            if (!this.m_Animations["dyingEnemy"].Enabled)
            {
                this.m_GameEngine.HandleHit(this, i_Collidable);
            }
        }
示例#6
0
        void ICollidable.Collided(ICollidable i_Collidable)
        {
            if (!(i_Collidable is SpaceShip) && (!this.m_Animations["Destroy"].Enabled))
            {
                if (this.m_GameEngine == null)
                {
                    this.m_GameEngine = Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
                }

                this.m_GameEngine.HandleHit(this, i_Collidable);
            }
        }
示例#7
0
        void ICollidable.Collided(ICollidable i_Collidable)
        {
            if (!this.Animations["DestroyMother"].Enabled)
            {
                if (this.m_GameEngine == null)
                {
                    this.m_GameEngine = this.Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
                }

                this.Animations["DestroyMother"].Restart();
                this.m_GameEngine.HandleHit(this, i_Collidable as Bullet);
            }
        }
示例#8
0
        public PlayScreen(Game i_Game)
            : base(i_Game)
        {
            this.m_ScoreBoard   = new ScoreBoardHeader(this);
            this.m_GameEngine   = Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
            this.m_SoundManager = Game.Services.GetService(typeof(ISoundMananger)) as ISoundMananger;

            i_Game.IsMouseVisible    = true;
            this.m_Background        = new Background(this, @"Sprites\BG_Space01_1024x768", 1);
            this.m_MotherSpaceShip   = new MotherSpaceShip(this);
            this.m_EnemysGroup       = new EnemiesGroup(this);
            this.m_WallsGroup        = new WallsGroup(this, SpaceInvadersConfig.k_NumOfWalls);
            this.m_PauseScreenScreen = new PauseScreen(this.Game);
        }
示例#9
0
        public override void Initialize()
        {
            if (this.m_GameEngine == null)
            {
                this.m_GameEngine = Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;
            }

            for (int i = 0; i < SpaceInvadersConfig.k_NumOfEnemiesRows; i++)
            {
                this.m_EnemiesGroup.Add(new List <Enemy>(SpaceInvadersConfig.k_NumOfEnemiesColumns));
            }

            this.initEnemyGroup();
            this.initAliveEnemiesByColum();
            base.Initialize();
        }
示例#10
0
        public override void Initialize()
        {
            this.m_GameEngine = this.Game.Services.GetService(typeof(ISpaceInvadersEngine)) as ISpaceInvadersEngine;

            base.Initialize();
        }