Exemplo n.º 1
0
        public PlayerSpaceInvaders(GameScreen i_GameScreen, string i_PlayerNickname, eSpaceShipType i_SpaceShipType)
            : base(i_GameScreen.Game, i_PlayerNickname)
        {
            m_LoseLifeSound = SoundFactory.CreateSound(this.Game, SoundFactory.eSoundType.LifeDie) as Sound;
            m_Nickname      = i_PlayerNickname;
            m_SpaceShipType = i_SpaceShipType;
            m_ScoreText     = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.SmallText) as Text;
            SpritesFactory.eSpriteType lifeType = SpritesFactory.eSpriteType.LifeBlueSpaceShip;

            switch (m_SpaceShipType)
            {
            case eSpaceShipType.Blue:
                m_SpaceShip           = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.BlueSpaceShip) as SpaceShip;
                m_ScoreText.TintColor = Color.Blue;
                lifeType = SpritesFactory.eSpriteType.LifeBlueSpaceShip;
                break;

            case eSpaceShipType.Green:
                m_SpaceShip           = SpritesFactory.CreateSprite(i_GameScreen, SpritesFactory.eSpriteType.GreenSpaceShip) as SpaceShip;
                m_ScoreText.TintColor = Color.Green;
                lifeType = SpritesFactory.eSpriteType.LifeGreenSpaceShip;
                break;
            }

            for (int i = 0; i < this.Lifes; i++)
            {
                Life life = SpritesFactory.CreateSprite(i_GameScreen, lifeType) as Life;
                life.Initialize();
                this.LifesSprites.Add(life);
            }
        }
Exemplo n.º 2
0
 public MotherShip(GameScreen i_GameScreen, string i_AssetName)
     : base(i_AssetName, i_GameScreen)
 {
     this.Points       = m_PointsToBeEarned;
     this.Velocity     = new Vector2(r_MotherShipVelocity, 0);
     m_SoundWhenKilled = SoundFactory.CreateSound(this.GameScreen, SoundFactory.eSoundType.MotherShipKill) as Sound;
 }
Exemplo n.º 3
0
 public Enemy(GameScreen i_GameScreen, Color i_EnemyColor, int i_TextureStartIndex, int i_TextureEndIndex, string i_AssetName)
     : base(i_GameScreen, i_AssetName)
 {
     m_TintColor         = i_EnemyColor;
     this.isDying        = false;
     m_SpriteJump        = new SpriteJump(this);
     r_TextureStartIndex = i_TextureStartIndex;
     r_TextureEndIndex   = i_TextureEndIndex;
     m_ShootSound        = SoundFactory.CreateSound(this.GameScreen, SoundFactory.eSoundType.EnemyGunShot) as Sound;
 }
Exemplo n.º 4
0
 protected override void Initialize()
 {
     m_SpriteBatch = new SpriteBatch(GraphicsDevice);
     this.Services.AddService(typeof(GraphicsDeviceManager), m_Graphics);
     this.Services.AddService(typeof(ContentManager), this.Content);
     this.Services.AddService(typeof(SpriteBatch), m_SpriteBatch);
     this.Services.AddService(typeof(CollisionServices), CollisionServices.Instance);
     this.Services.AddService(typeof(SpaceInvadersSoundsMng), new SpaceInvadersSoundsMng());
     this.Services.AddService(typeof(ScreenOptionsMng), new ScreenOptionsMng(this));
     this.Services.AddService(typeof(MultiPlayerConfiguration), new MultiPlayerConfiguration());
     m_BackgroundMusic          = SoundFactory.CreateSound(this, SoundFactory.eSoundType.BackgroundMusic) as Sound;
     m_BackgroundMusic.Volume   = 0.3f;
     m_BackgroundMusic.isLooped = true;
     m_BackgroundMusic.Play();
     base.Initialize();
 }
Exemplo n.º 5
0
        public override void Initialize()
        {
            initilizeOnFirstRun();
            SpritesFactory.CreateSprite(this, SpritesFactory.eSpriteType.MotherShip);
            SpritesFactory.CreateSprite(this, SpritesFactory.eSpriteType.SpaceBackground);
            EnemiesMatrix enemiesMatrix = new EnemiesMatrix(this);
            BarrierGroup  barrierGroup  = new BarrierGroup(this);

            m_MultiPlayerConfiguration = SpaceInvadersServices.GetMultiPlayerConfiguration(this.Game);
            m_MultiPlayerConfiguration.CreatePlayers(this);
            m_WonLevelSound = SoundFactory.CreateSound(this, SoundFactory.eSoundType.LevelWin);
            m_GameOverSound = SoundFactory.CreateSound(this, SoundFactory.eSoundType.GameOver);
            this.Add(enemiesMatrix);
            this.Add(barrierGroup);
            base.Initialize();
            SpaceInvadersServices.ChangeBarriersGroupVerticalPosition(this, barrierGroup);
        }
Exemplo n.º 6
0
        public GameMenuItem(string i_ItemName, GameScreen i_GameScreen, Color i_Color, eFontSize i_FontSize = eFontSize.Big, params MethodKey[] i_Methods)
            : base(i_ItemName, i_Methods)
        {
            switch (i_FontSize)
            {
            case eFontSize.Medium:
                m_TextSpriteType = SpritesFactory.eSpriteType.MediumText;
                break;

            case eFontSize.Small:
                m_TextSpriteType = SpritesFactory.eSpriteType.SmallText;
                break;
            }

            m_Text                  = SpritesFactory.CreateSprite(i_GameScreen, m_TextSpriteType) as Text;
            m_Text.TextString       = i_ItemName;
            m_Text.TintColor        = r_OriginalColor = i_Color;
            m_GameScreen            = i_GameScreen;
            m_MoveBetweenItemsSound = SoundFactory.CreateSound(this.m_GameScreen, SoundFactory.eSoundType.MenuMove);
        }
Exemplo n.º 7
0
 public SpaceShip(GameScreen i_GameScreen, string i_AssetName)
     : base(i_GameScreen, i_AssetName)
 {
     m_ShootSound = SoundFactory.CreateSound(this.GameScreen, SoundFactory.eSoundType.LifeDie) as Sound;
 }
Exemplo n.º 8
0
 public Barrier(GameScreen i_GameScreen, string i_AssetName)
     : base(i_AssetName, i_GameScreen)
 {
     m_CollisionServices = this.Game.Services.GetService(typeof(CollisionServices)) as CollisionServices;
     m_HitSound          = SoundFactory.CreateSound(this.GameScreen, SoundFactory.eSoundType.BarrierHit) as Sound;
 }