Пример #1
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;
 }
        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);
            }
        }
Пример #3
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();
 }
Пример #4
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);
        }
Пример #5
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;
 }
Пример #6
0
 public void RemoveSound(Sound i_Sound)
 {
     m_Sounds.Remove(i_Sound);
 }
Пример #7
0
 public void AddSound(Sound i_Sound)
 {
     m_Sounds.Add(i_Sound);
 }
Пример #8
0
 public void SetSoundByInstanceType(Sound i_Sound)
 {
     foreach (KeyValuePair<string, VolumeInstance> volumeInstance in this.m_VolumeInstances)
     {
         if (volumeInstance.Value.SoundType == i_Sound.GetType())
         {
             i_Sound.Volume = volumeInstance.Value.Volume;
             break;
         }
     }
 }