Beispiel #1
0
 protected SoundManager(int numNodes = 9, int growthSize = 1)
     : base(numNodes, growthSize)
 {
     poSndEngine   = new IrrKlang.ISoundEngine();
     poCompareNode = new Sound();
     Debug.Assert(poCompareNode != null);
 }
Beispiel #2
0
        public Dictionary <int, List <string> > 시간들; // in ms

        public SoundMgr()
        {
            사운드엔진        = new IrrKlang.ISoundEngine();
            타이머          = new System.Timers.Timer();
            타이머.Interval = 40; // ms
            타이머.Elapsed += new ElapsedEventHandler(timer_Elapsed);
        }
Beispiel #3
0
 public AlienGridAnimation(AlienGrid grid, IrrKlang.ISoundEngine eng)
 {
     this.grid = grid;
     Debug.Assert(eng != null);
     this.soundEngine = eng;
     count            = 0;
 }
Beispiel #4
0
        public void loadAliens()
        {
            AlienFactory alienFactory = FactoryManager.getAlienFactry();
            AlienGrid    alienGrid    = (AlienGrid)alienFactory.createAlien(Alien.AlienType.AlienGrid, GameObject.GameObjectName.AlienGrid, 0);

            alienFactory.setParent(alienGrid);

            for (int i = 0; i < 11; i++)
            {
                alienFactory.setParent(alienGrid);

                Alien pColumn = alienFactory.createAlien(Alien.AlienType.Column, GameObject.GameObjectName.Column, i + 1, 0.0f, 0.0f);

                //set Parent
                alienFactory.setParent(pColumn);
                float x = Unit.alienPosX;
                float y = Unit.alienPosY;

                alienFactory.createAlien(Alien.AlienType.Crab, GameObject.GameObjectName.Crab, i + 2, x + i * 50.0f, y);

                alienFactory.createAlien(Alien.AlienType.Squid, GameObject.GameObjectName.Squid, i + 3, x + i * 50.0f, y - 60);

                alienFactory.createAlien(Alien.AlienType.Squid, GameObject.GameObjectName.Squid, i + 4, x + i * 50.0f, y - 120);

                alienFactory.createAlien(Alien.AlienType.Octopus, GameObject.GameObjectName.Octopus, i + 5, x + i * 50.0f, y - 180);

                alienFactory.createAlien(Alien.AlienType.Octopus, GameObject.GameObjectName.Octopus, i + 6, x + i * 50.0f, y - 240);
            }
            IrrKlang.ISoundEngine sndEngine    = FactoryManager.getSoundEngine();
            AlienGridAnimation    alienGridAni = new AlienGridAnimation(alienGrid, sndEngine);

            TimerManager.sortedAdd(TimerEvent.TimerEventName.SpriteAnimation, alienGridAni, Unit.AlienGridMoveEventTime);
        }
Beispiel #5
0
 public static void Create(int reserveSize = 9, int reserveGrowth = 1)
 {
     if (pInstance == null)
     {
         soundEngine = new IrrKlang.ISoundEngine();
         pInstance   = new SoundManager(reserveSize, reserveGrowth);
     }
 }
        public SndObserver(IrrKlang.ISoundEngine pEng, String pSnd)
        {
            Debug.Assert(pEng != null);
            this.pSndEngine = pEng;

            Debug.Assert(pSnd != null);
            this.pSndName = pSnd;
        }
Beispiel #7
0
        public MoveGrid(Composite pGrid, IrrKlang.ISoundEngine pEng)
        {
            Debug.Assert(pGrid != null);
            this.pGrid = pGrid;

            Debug.Assert(pEng != null);
            this.pSndEngine = pEng;
        }
Beispiel #8
0
        //----------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------
        public void Set(Name name, String soundFileName, IrrKlang.ISoundEngine soundEngine)
        {
            Debug.Assert(soundFileName != null);
            Debug.Assert(soundEngine != null);

            this.name  = name;
            this.sound = soundEngine.AddSoundSourceFromFile(soundFileName);
            Debug.Assert(this.sound != null);
        }
 //methods
 public void Set(Name name, string pSoundName, ref IrrKlang.ISoundEngine pSoundEngine)
 {
     this.name = name;
     Debug.Assert(pSoundName != null);
     if (System.IO.File.Exists(pSoundName))
     {
         this.pSource = pSoundEngine.AddSoundSourceFromFile(pSoundName);
     }
 }
Beispiel #10
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            irrKlangEngine = new IrrKlang.ISoundEngine();
            ThemeManager.ChangeTheme(this, ThemeManager.DefaultAccents.First(a => a.Name == "Blue"), Theme.Dark);
            volumeTrackBar.Value = 100;

            ListViewPlaylist.AddHandler(MetroContentControl.MouseDoubleClickEvent, new RoutedEventHandler(Playlist_DoubleClick));
        }
Beispiel #11
0
 public override void execute(float deltaTime)
 {
     IrrKlang.ISoundEngine soundEngine = FactoryManager.getSoundEngine();
     if (ufo.launch)
     {
         IrrKlang.ISound music = soundEngine.Play2D("ufo_lowpitch.wav");
         music.Volume = 0.2f;
         TimerManager.sortedAdd(TimerEvent.TimerEventName.UFOPlaySound, this, 2.2f);
     }
 }
Beispiel #12
0
 public Form1()
 {
     InitializeComponent();
     vrijeme = 0;
     interval = 500;
     reprodukcija = false;
     shuffle_ukljucen = false;
     repeat_ukljucen = false;
     irrKlangEngine = new IrrKlang.ISoundEngine();
 }
Beispiel #13
0
        public override void Execute(float deltaTime)
        {
            ActivateUFO();
            IrrKlang.ISoundEngine pSndEngine = GameMan.GetGame().GetSndEngine();
            pSndEngine.Play2D("ufo_lowpitch.wav");

            TimerMan.Add(TimeEvent.Name.SendUFO, this, deltaTime);
            TimerMan.Add(TimeEvent.Name.UFOBomb, new UFOBombDrop(this.pUFO), 1.0f);
            TimerMan.Add(TimeEvent.Name.PlaySound, new UFOSound(), 1.5f);
        }
Beispiel #14
0
		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			// create irrklang sound engine
			irrKlangEngine = new IrrKlang.ISoundEngine();
			playSelectedFile();
		}
Beispiel #15
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // create irrklang sound engine
            irrKlangEngine = new IrrKlang.ISoundEngine();
            playSelectedFile();
        }
        //  string path;
        public Metronome()
        {
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer |
            ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor,
            true);

              //  path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
              //  path = Application.StartupPath;

            this.BackColor = Color.Transparent;

            this.Width = 200;
            this.Height = 50;

            this.DoubleBuffered = true;

            slider.Location = new Point(40, 20);
            slider.Width = 110;
            slider.Height = 25;
            slider.Minimum = 60;
            slider.Maximum = 220;
            slider.Value = 120;
            slider.ValueChanged += new EventHandler(slider_ValueChanged);
            this.Controls.Add(slider);

            textbpm = new NumericUpDown();
            textbpm.BorderStyle = BorderStyle.FixedSingle;
            textbpm.BackColor = Color.FromArgb(137, 138, 139);
            textbpm.Maximum = 220;
            textbpm.Minimum = 60;

            textbpm.Width = 40;
            textbpm.Location = new Point(153, 20);
            textbpm.Value = BPM;
            textbpm.ValueChanged += new EventHandler(textbpm_ValueChanged);
            this.Controls.Add(textbpm);

            engine = new IrrKlang.ISoundEngine();

            if(File.Exists(Application.StartupPath + @"\Sounds\metronome.wav"))
                addsource(engine, Application.StartupPath + @"\Sounds\metronome.wav", "Tick");

            //addsource(engine, @"C:\Users\Rickey\Documents\Visual Studio 2008\Projects\Rockband Drum Kit\Rockband Drum Kit\bin\Release\Sounds\metronome.wav", "Tick");

            engine.SoundVolume = 2F;

            this.Click += new EventHandler(Metronome_Click);
            this.MouseEnter += new EventHandler(Metronome_MouseEnter);
            this.MouseLeave += new EventHandler(Metronome_MouseLeave);

              //  loopthread = new Thread(new ThreadStart(SetUpThread));
            //loopthread.Start();
            SetUpThread();
        }
Beispiel #17
0
 public SoundUtility()
 {
     sndEngine      = new IrrKlang.ISoundEngine();
     sndExplosion   = sndEngine.AddSoundSourceFromFile("explosion.wav");
     sndAdvance1    = sndEngine.AddSoundSourceFromFile("fastinvader1.wav");
     sndAdvance2    = sndEngine.AddSoundSourceFromFile("fastinvader2.wav");
     sndAdvance3    = sndEngine.AddSoundSourceFromFile("fastinvader3.wav");
     sndAdvance4    = sndEngine.AddSoundSourceFromFile("fastinvader4.wav");
     sndShoot       = sndEngine.AddSoundSourceFromFile("shoot.wav");
     sndAlienKilled = sndEngine.AddSoundSourceFromFile("invaderkilled.wav");
     sndUFO         = sndEngine.AddSoundSourceFromFile("ufo_highpitch.wav");
 }
Beispiel #18
0
        //this is hopefully going to sound of every 1 second not sure if thats what its supposed to do
        public override void Execute(float deltaTime)
        {
            SpaceInvaders pGame = GameMan.GetGame();

            IrrKlang.ISoundEngine pSndEngine = pGame.GetSndEngine();

            pSndEngine.SoundVolume = 0.1f;
            pSndEngine.Play2D("ufo_lowpitch.wav");


            TimerMan.Add(TimeEvent.Name.PlaySound, this, deltaTime);
        }
Beispiel #19
0
        private IrrKlang.ISoundSource LookupSource(SoundName soundName)
        {
            IrrKlang.ISoundSource pSource      = null;
            IrrKlang.ISoundEngine pSoundEngine = SoundManager.GetEngine();
            switch (soundName)
            {
            case SoundName.explosion:
                pSource = pSoundEngine.AddSoundSourceFromFile("explosion.wav");
                break;

            case SoundName.fastInvader1:
                pSource = pSoundEngine.AddSoundSourceFromFile("fastinvader1.wav");
                break;

            case SoundName.fastInvader2:
                pSource = pSoundEngine.AddSoundSourceFromFile("fastinvader2.wav");
                break;

            case SoundName.fastInvader3:
                pSource = pSoundEngine.AddSoundSourceFromFile("fastinvader3.wav");
                break;

            case SoundName.fastInvader4:
                pSource = pSoundEngine.AddSoundSourceFromFile("fastinvader4.wav");
                break;

            case SoundName.invaderKilled:
                pSource = pSoundEngine.AddSoundSourceFromFile("invaderkilled.wav");
                break;

            case SoundName.shoot:
                pSource = pSoundEngine.AddSoundSourceFromFile("shoot.wav");
                break;

            case SoundName.ufoHighPitch:
                pSource = pSoundEngine.AddSoundSourceFromFile("ufo_highpitch.wav");
                break;

            case SoundName.ufoLowPitch:
                pSource = pSoundEngine.AddSoundSourceFromFile("ufo_lowpitch.wav");
                break;

            case SoundName.Null:
                pSource = null;
                break;

            default:
                Debug.Assert(false);
                break;
            }
            return(pSource);
        }
Beispiel #20
0
        private AudioManager()
        {
            sndEngine = new IrrKlang.ISoundEngine();

            //EventManager.Instance.AddListener(EVENT_TYPE.EXPLOSION, this);
            // EventManager.Instance.AddListener(EVENT_TYPE.FENCE_HIT, this);
            // EventManager.Instance.AddListener(EVENT_TYPE.MISSILE_HIT, this);
            // EventManager.Instance.AddListener(EVENT_TYPE.PLAYER_KILLED, this);
            // EventManager.Instance.AddListener(EVENT_TYPE.MINE_LAYED, this);
            // EventManager.Instance.AddListener(EVENT_TYPE.MINE_DESPAWN, this);
            //  EventManager.Instance.AddListener(EVENT_TYPE.MISSILE_FIRE, this);
            //  EventManager.Instance.AddListener(EVENT_TYPE.MINE_ARMED, this);
        }
Beispiel #21
0
        //-----------------------------------------------------------------------------
        // Game::LoadContent()
        //		Allows you to load all content needed for your engine,
        //	    such as objects, graphics, etc.
        //-----------------------------------------------------------------------------
        public override void LoadContent()
        {
            //---------------------------------------------------------------------------------------------------------
            // Audio
            //---------------------------------------------------------------------------------------------------------

            // Create the Audio Engine
            AudioEngine = new IrrKlang.ISoundEngine();

            // Play a sound file
            music        = AudioEngine.Play2D("theme.wav", true);
            music.Volume = 0.2f;

            // Resident loads
            srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav");
            sndShoot = AudioEngine.Play2D(srcShoot, false, false, false);
            sndShoot.Stop();

            //---------------------------------------------------------------------------------------------------------
            // Setup Font
            //---------------------------------------------------------------------------------------------------------

            // Font - texture
            pFont = new Azul.Texture("consolas20pt.tga");
            Debug.Assert(pFont != null);

            GlyphMan.AddXml("Consolas20pt.xml", pFont);

            //---------------------------------------------------------------------------------------------------------
            // Load the Textures
            //---------------------------------------------------------------------------------------------------------

            // Red bird texture
            pText = new Azul.Texture("unsorted.tga");
            Debug.Assert(pText != null);

            //---------------------------------------------------------------------------------------------------------
            // Create Sprites
            //---------------------------------------------------------------------------------------------------------

            pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f), new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f));
            Debug.Assert(pRedBird != null);

            //---------------------------------------------------------------------------------------------------------
            // Demo variables
            //---------------------------------------------------------------------------------------------------------

            stats = new GameStats();
        }
Beispiel #22
0
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // create irrklang sound engine

            filepath = "C:\\Users\\BA042808\\Music\\test";
            currentlySelectedIndex = 0;
            loadFileNames();

            irrKlangEngine = new IrrKlang.ISoundEngine();
            playSelectedFile();
        }
Beispiel #23
0
        public override void shoot(CannonShip ship)
        {
            // Debug.WriteLine("ShipReadyState shoot");
            StraightMissile missile = ShipManager.activateMissile();

            Debug.Assert(missile != null);

            missile.x = ship.x;
            missile.y = ship.y;
            missile.launchMissile();

            IrrKlang.ISoundEngine sndEngine = FactoryManager.getSoundEngine();
            IrrKlang.ISound       music     = sndEngine.Play2D("shoot.wav");
            music.Volume = 0.2f;

            this.handle(ship);
        }
        //Methods

        public static void Create(int reserveNum = 1, int reserveGrow = 1)
        {
            // make sure values are ressonable
            Debug.Assert(reserveNum > 0);
            Debug.Assert(reserveGrow > 0);

            // initialize the singleton here
            Debug.Assert(pInstance == null);
            Debug.Assert(pSoundEngine == null);

            // Do the initialization
            if (pInstance == null && pSoundEngine == null)
            {
                pInstance    = new SoundManager(reserveNum, reserveGrow);
                pSoundEngine = new IrrKlang.ISoundEngine();
            }
        }
Beispiel #25
0
        public Player()
        {
            InitializeComponent();

            irrKlangEngine = new IrrKlang.ISoundEngine();

            tbarVolume.Value = 100;

            playlist = new Playlist(this);
            this.AddOwnedForm(playlist);
            playlist.Show();
            UpdatePlaylistPosition();

            timer = new Timer();
            timer.Enabled = true;
            timer.Interval = 500;
            timer.Tick += new EventHandler(tbarProgress_Update);
        }
Beispiel #26
0
        public SoundManager(Viewer _viewer)
            : base(_viewer, -1)
        {
            try
            {
                engine = new IrrKlang.ISoundEngine();

                if (engine == null)
                    Reference.Log.Debug("Constructor: Engine NULL");
            }
            catch (Exception e)
            {
                Reference.Log.Debug("Constructor: ERROR:" + e.Message);
                engine = null;
            }

            ChangeWorkDirectory(Util.SoundFolder);
        }
Beispiel #27
0
        public override void Execute(float deltaTime)
        {
            Composite pFlyingSaucerRoot = GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.FlyingSaucerRoot);

            IrrKlang.ISoundEngine pSoundEngine = SoundEngineManager.GetSoundEngine();

            // If flying saucer is active
            if (pFlyingSaucerRoot.GetFirstChild() != null)
            {
                // Check to see if sound is currently playing
                if (!pSoundEngine.IsCurrentlyPlaying("ufo_lowpitch.wav"))
                {
                    IrrKlang.ISound pSnd = pSoundEngine.Play2D("ufo_lowpitch.wav");
                }

                base.Execute(deltaTime);
            }
        }
Beispiel #28
0
        public Form1()
        {
            InitializeComponent();
            songList.ColumnCount           = columns;
            songList.Columns[title].Name   = "Title";
            songList.Columns[artist].Name  = "Artist";
            songList.Columns[album].Name   = "Album";
            songList.Columns[genre].Name   = "Genre";
            songList.Columns[track].Name   = "Track";
            songList.Columns[year].Name    = "Year";
            songList.Columns[size].Name    = "Size";
            songList.Columns[loc].Name     = "Location";
            songList.Columns[root].Name    = "Root";
            songList.Columns[9].Name       = "Length";
            songList.Columns[loc].Visible  = false;
            songList.Columns[root].Visible = false;
            songList.SelectionMode         = DataGridViewSelectionMode.FullRowSelect;
            songList.MultiSelect           = true;

            if (!System.IO.File.Exists(folderList))
            {
                directories = new Dictionary <string, List <string> >
                {
                    { @"C:/test", new List <string> {
                      } }
                };

                System.IO.File.WriteAllText(folderList, JsonConvert.SerializeObject(directories, Formatting.Indented));
            }
            else
            {
                directories = JsonConvert.DeserializeObject <Dictionary <string, List <string> > >(System.IO.File.ReadAllText(folderList));
            }

            getSongs();

            irrKlangEngine = new IrrKlang.ISoundEngine();
            waveOutDevice  = new WaveOut();

            songList.UserDeletingRow += songList_UserDeletingRow;
            songList.ClearSelection();
        }
Beispiel #29
0
        // Author: Brandon Wegner
        public override void LoadContent()
        {
            AudioEngine = new IrrKlang.ISoundEngine();

            music        = AudioEngine.Play2D("theme.wav", true);
            music.Volume = 0.2f;

            srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav");
            sndShoot = AudioEngine.Play2D(srcShoot, false, false, false);
            sndShoot.Stop();

            pFont = new Azul.Texture("consolas20pt.tga");

            GlyphMan.AddXml("Consolas20pt.xml", pFont);

            pText = new Azul.Texture("unsorted.tga");

            pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f),
                                       new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f));
        }
Beispiel #30
0
        private FactoryManager()
        {
            SpriteBatch alienBatch   = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.Aliens);
            PCSTree     alienPcsTree = new PCSTree();

            this.alienFactory = new AlienFactory(alienPcsTree, alienBatch);

            SpriteBatch bombBatch   = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.Bombs);
            PCSTree     bombPcsTree = new PCSTree();

            this.bombFactory = new BombFactory(bombPcsTree, bombBatch);

            SpriteBatch missileBatch   = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.Missiles);
            PCSTree     missilePcsTree = new PCSTree();

            this.missileFactory = new MissileFactory(missilePcsTree, missileBatch);


            SpriteBatch shieldBatch   = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.Shields);
            PCSTree     shieldPcsTree = new PCSTree();

            this.shieldFactory = new ShieldFactory(shieldPcsTree, shieldBatch);

            SpriteBatch shipBatch   = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.Ships);
            PCSTree     shipPcsTree = new PCSTree();

            this.shipFactory = new ShipFactory(shipPcsTree, shipBatch);

            SpriteBatch wallBatch   = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.Walls);
            PCSTree     wallPcsTree = new PCSTree();

            this.wallFactory = new WallFactory(wallPcsTree, wallBatch);


            SpriteBatch ufoBatch   = SpriteBatchManager.add(SpriteBatch.SpriteBatchName.UFOs);
            PCSTree     ufoPcsTree = new PCSTree();

            this.ufoFactory = new UFOFactory(ufoPcsTree, ufoBatch);

            sndEngine = new IrrKlang.ISoundEngine();
        }
        public AlienNumObserver(IrrKlang.ISoundEngine pEng)
        {
            int        count    = 0;
            GameObject pGameObj = GameObjectMan.Find(GameObject.Name.AlienGroup);

            AlienGroup      pAlienGroup = (AlienGroup)pGameObj;
            ForwardIterator pFor        = new ForwardIterator(pAlienGroup);

            Component pNode = pFor.First();

            while (!pFor.IsDone())
            {
                if (pNode.holder == Component.Container.LEAF)
                {
                    count++;
                }
                pNode = pFor.Next();
            }

            this.num       = count;
            this.initial   = count;
            this.sndEngine = pEng;
        }
Beispiel #32
0
        // strategy()
        override public void LoadContent()
        {
            AlienGroup.ResetDirection();

            TextureMan.Create(2, 1);
            ImageMan.Create(5, 2);
            GameSpriteMan.Create(4, 2);
            BoxSpriteMan.Create(3, 1);
            SpriteBatchMan.Create(3, 1);
            TimerMan.Create(3, 1);
            ProxySpriteMan.Create(10, 1);
            GameObjectMan.Create(3, 1);
            ColPairMan.Create(1, 1);
            Simulation.Create();
            GlyphMan.Create(3, 1);
            FontMan.Create(1, 1);
            //GhostSpriteBatchMan.Create(2, 1);

            //---------------------------------------------------------------------------------------------------------
            // Sound Experiment
            //---------------------------------------------------------------------------------------------------------

            // start up the engine
            sndEngine = new IrrKlang.ISoundEngine();

            //---------------------------------------------------------------------------------------------------------
            // Load the Textures
            //---------------------------------------------------------------------------------------------------------

            TextureMan.Add(Texture.Name.Aliens, "newaliens.tga");
            TextureMan.Add(Texture.Name.Shields, "birds_N_shield.tga");
            Texture pTexture = TextureMan.Add(Texture.Name.Consolas20pt, "Consolas20pt.tga");

            FontMan.AddXml(Glyph.Name.Consolas20pt, "Consolas20pt.xml", Texture.Name.Consolas20pt);

            //---------------------------------------------------------------------------------------------------------
            // Load the Images
            //---------------------------------------------------------------------------------------------------------

            ImageMan.Add(Image.Name.SquidA, Texture.Name.Aliens, 547, 15, 250, 135);
            ImageMan.Add(Image.Name.CrabA, Texture.Name.Aliens, 281, 15, 250, 135);
            ImageMan.Add(Image.Name.OctopusA, Texture.Name.Aliens, 15, 15, 250, 135);

            ImageMan.Add(Image.Name.SquidB, Texture.Name.Aliens, 547, 170, 250, 135);
            ImageMan.Add(Image.Name.CrabB, Texture.Name.Aliens, 281, 170, 250, 135);
            ImageMan.Add(Image.Name.OctopusB, Texture.Name.Aliens, 15, 170, 250, 135);

            ImageMan.Add(Image.Name.MissileBombCol, Texture.Name.Aliens, 395, 480, 130, 130);
            ImageMan.Add(Image.Name.AlienDies, Texture.Name.Aliens, 550, 480, 220, 130);

            ImageMan.Add(Image.Name.UFO, Texture.Name.Aliens, 80, 500, 230, 100);
            ImageMan.Add(Image.Name.UFODies, Texture.Name.Aliens, 15, 630, 355, 140);

            ImageMan.Add(Image.Name.Missile, Texture.Name.Aliens, 370, 795, 30, 105);
            ImageMan.Add(Image.Name.MissileBombDies, Texture.Name.Aliens, 685, 790, 110, 130);
            ImageMan.Add(Image.Name.Ship, Texture.Name.Aliens, 50, 325, 190, 125);
            ImageMan.Add(Image.Name.ShipDiesA, Texture.Name.Aliens, 280, 325, 245, 130);
            ImageMan.Add(Image.Name.ShipDiesB, Texture.Name.Aliens, 545, 325, 245, 130);

            ImageMan.Add(Image.Name.BombRoll, Texture.Name.Aliens, 445, 795, 50, 105);
            ImageMan.Add(Image.Name.BombZigZag, Texture.Name.Aliens, 560, 630, 70, 140);
            ImageMan.Add(Image.Name.BombCross, Texture.Name.Aliens, 110, 790, 50, 100);
            ImageMan.Add(Image.Name.BombFork, Texture.Name.Aliens, 520, 790, 50, 100);
            ImageMan.Add(Image.Name.BombStraight, Texture.Name.Aliens, 370, 795, 30, 105);

            ImageMan.Add(Image.Name.Brick, Texture.Name.Shields, 20, 210, 10, 5);
            ImageMan.Add(Image.Name.BrickLeft_Top0, Texture.Name.Shields, 15, 180, 10, 5);
            ImageMan.Add(Image.Name.BrickLeft_Top1, Texture.Name.Shields, 15, 185, 10, 5);
            ImageMan.Add(Image.Name.BrickLeft_Bottom, Texture.Name.Shields, 35, 215, 10, 5);
            ImageMan.Add(Image.Name.BrickRight_Top0, Texture.Name.Shields, 75, 180, 10, 5);
            ImageMan.Add(Image.Name.BrickRight_Top1, Texture.Name.Shields, 75, 185, 10, 5);
            ImageMan.Add(Image.Name.BrickRight_Bottom, Texture.Name.Shields, 55, 215, 10, 5);

            //---------------------------------------------------------------------------------------------------------
            // Create Sprites
            //---------------------------------------------------------------------------------------------------------

            GameSpriteMan.Add(GameSprite.Name.Squid, Image.Name.SquidA, 100, 600, 35, 30, 255, 255, 255, 1);
            GameSpriteMan.Add(GameSprite.Name.Crab, Image.Name.CrabA, 100, 550, 35, 30, 255, 255, 255, 1);
            GameSpriteMan.Add(GameSprite.Name.Octopus, Image.Name.OctopusA, 100, 500, 35, 30, 255, 255, 255, 1);
            GameSpriteMan.Add(GameSprite.Name.AlienDies, Image.Name.AlienDies, 0, 0, 35, 30, 255, 255, 255, 1);
            GameSpriteMan.Add(GameSprite.Name.UFO, Image.Name.UFO, 100, 500, 35, 30, 255, 0, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.UFODies, Image.Name.UFODies, 0, 0, 35, 30, 255, 0, 0, 1);

            GameSpriteMan.Add(GameSprite.Name.Missile, Image.Name.Missile, 100, 200, 10, 20, 255, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.MissileDies, Image.Name.MissileBombDies, 0, 0, 10, 20, 255, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.MissileBombCol, Image.Name.MissileBombCol, 0, 0, 10, 20, 255, 255, 255, 1);
            GameSpriteMan.Add(GameSprite.Name.Ship, Image.Name.Ship, 300, 30, 40, 20, 255, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.ShipDies, Image.Name.ShipDiesA, 0, 0, 50, 25, 255, 255, 0, 1);

            GameSpriteMan.Add(GameSprite.Name.BombZigZag, Image.Name.BombZigZag, 0, 0, 10, 20, 255, 0, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.BombRolling, Image.Name.BombRoll, 0, 0, 10, 20, 255, 0, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.BombDagger, Image.Name.BombCross, 0, 0, 10, 20, 255, 0, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.BombStraight, Image.Name.BombStraight, 0, 0, 10, 20, 255, 0, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.BombFork, Image.Name.BombFork, 0, 0, 12, 24, 255, 0, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.BombDies, Image.Name.MissileBombDies, 0, 0, 10, 20, 255, 0, 0, 1);

            GameSpriteMan.Add(GameSprite.Name.Brick, Image.Name.Brick, 50, 25, 10, 5, 0, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop0, Image.Name.BrickLeft_Top0, 50, 25, 10, 5, 0, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftTop1, Image.Name.BrickLeft_Top1, 50, 25, 10, 5, 0, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.Brick_LeftBottom, Image.Name.BrickLeft_Bottom, 50, 25, 10, 5, 0, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightTop0, Image.Name.BrickRight_Top0, 50, 25, 10, 5, 0, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightTop1, Image.Name.BrickRight_Top1, 50, 25, 10, 5, 0, 255, 0, 1);
            GameSpriteMan.Add(GameSprite.Name.Brick_RightBottom, Image.Name.BrickRight_Bottom, 50, 25, 10, 5, 0, 255, 0, 1);

            SpriteBatch pSB_Aliens  = SpriteBatchMan.Add(SpriteBatch.Name.Aliens);
            SpriteBatch pSB_Box     = SpriteBatchMan.Add(SpriteBatch.Name.Boxes);
            SpriteBatch pSB_Shields = SpriteBatchMan.Add(SpriteBatch.Name.Shields);
            SpriteBatch pSB_Texts   = SpriteBatchMan.Add(SpriteBatch.Name.Texts);

            //SpriteBatch pSB_GhostAliens = GhostSpriteBatchMan.Add(SpriteBatch.Name.Aliens);
            //SpriteBatch pSB_GhostBox = GhostSpriteBatchMan.Add(SpriteBatch.Name.Boxes);
            //SpriteBatch pSB_GhostShields = GhostSpriteBatchMan.Add(SpriteBatch.Name.Shields);

            //---------------------------------------------------------------------------------------------------------
            // GameObject
            //---------------------------------------------------------------------------------------------------------

            AnimationSprite pAnimSpriteSquid   = new AnimationSprite(GameSprite.Name.Squid);
            AnimationSprite pAnimSpriteCrab    = new AnimationSprite(GameSprite.Name.Crab);
            AnimationSprite pAnimSpriteOctopus = new AnimationSprite(GameSprite.Name.Octopus);

            pAnimSpriteSquid.Attach(Image.Name.SquidB);
            pAnimSpriteSquid.Attach(Image.Name.SquidA);
            pAnimSpriteCrab.Attach(Image.Name.CrabB);
            pAnimSpriteCrab.Attach(Image.Name.CrabA);
            pAnimSpriteOctopus.Attach(Image.Name.OctopusB);
            pAnimSpriteOctopus.Attach(Image.Name.OctopusA);

            TimerMan.Add(TimerEvent.Name.SquidAnimation, pAnimSpriteSquid, pMoveRate);
            TimerMan.Add(TimerEvent.Name.CrabAnimation, pAnimSpriteCrab, pMoveRate);
            TimerMan.Add(TimerEvent.Name.OctopusAnimation, pAnimSpriteOctopus, pMoveRate);

            //---------------------------------------------------------------------------------------------------------
            // Create Walls
            //---------------------------------------------------------------------------------------------------------

            WallGroup pWallGroup = new WallGroup(GameObject.Name.WallGroup, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pWallGroup.ActivateGameSprite(pSB_Aliens);
            pWallGroup.ActivateCollisionSprite(pSB_Box);

            WallBottom pWallBottom = new WallBottom(GameObject.Name.WallBottom, GameSprite.Name.NullObject, 336, 35, 750, 10);

            pWallBottom.ActivateCollisionSprite(pSB_Box);
            pWallGroup.Add(pWallBottom);

            WallRight pWallRight = new WallRight(GameObject.Name.WallRight, GameSprite.Name.NullObject, 722, 384, 120, 765);

            pWallRight.ActivateCollisionSprite(pSB_Box);
            pWallGroup.Add(pWallRight);

            WallLeft pWallLeft = new WallLeft(GameObject.Name.WallLeft, GameSprite.Name.NullObject, -45, 384, 120, 765);

            pWallLeft.ActivateCollisionSprite(pSB_Box);
            pWallGroup.Add(pWallLeft);

            WallTop pWallTop = new WallTop(GameObject.Name.WallTop, GameSprite.Name.NullObject, 336, 685, 750, 10);

            pWallTop.ActivateCollisionSprite(pSB_Box);
            pWallGroup.Add(pWallTop);

            GameObjectMan.Attach(pWallGroup);

            //---------------------------------------------------------------------------------------------------------
            // Create Bumper
            //---------------------------------------------------------------------------------------------------------

            BumperGroup pBumperGroup = new BumperGroup(GameObject.Name.BumperGroup, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pBumperGroup.ActivateGameSprite(pSB_Aliens);
            pBumperGroup.ActivateCollisionSprite(pSB_Box);

            BumperRight pBumperRight = new BumperRight(GameObject.Name.BumperRight, GameSprite.Name.NullObject, 650, 55, 15, 20);

            pBumperRight.ActivateCollisionSprite(pSB_Box);
            pBumperGroup.Add(pBumperRight);

            BumperLeft pBumperLeft = new BumperLeft(GameObject.Name.BumperLeft, GameSprite.Name.NullObject, 20, 55, 15, 20);

            pBumperLeft.ActivateCollisionSprite(pSB_Box);
            pBumperGroup.Add(pBumperLeft);

            GameObjectMan.Attach(pBumperGroup);

            //---------------------------------------------------------------------------------------------------------
            // Create Ship
            //---------------------------------------------------------------------------------------------------------

            ShipRoot pShipRoot = new ShipRoot(GameObject.Name.ShipRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pShipRoot.ActivateCollisionSprite(pSB_Box);
            GameObjectMan.Attach(pShipRoot);
            ShipMan.Create(new SndObserver(sndEngine, SndObserver.Name.ShootMissile));

            Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 50, 20, null);

            pShip.ActivateCollisionSprite(pSB_Box);
            pShip.ActivateGameSprite(pSB_Aliens);
            pShipRoot.Add(pShip);

            //---------------------------------------------------------------------------------------------------------
            // Bomb
            //---------------------------------------------------------------------------------------------------------

            BombRoot pBombRoot = new BombRoot(GameObject.Name.BombRoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pBombRoot.ActivateCollisionSprite(pSB_Box);

            GameObjectMan.Attach(pBombRoot);

            //---------------------------------------------------------------------------------------------------------
            // Explosion
            //---------------------------------------------------------------------------------------------------------

            ExplosionFactory explosionFactory = new ExplosionFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes);
            ExplosionGroup   pExplosionGroup  = (ExplosionGroup)explosionFactory.Create(GameObject.Name.ExplosionGroup, GameSprite.Name.NullObject);

            GameObjectMan.Attach(pExplosionGroup);

            //---------------------------------------------------------------------------------------------------------
            // Create Missile
            //---------------------------------------------------------------------------------------------------------

            MissileGroup pMissileGroup = new MissileGroup(GameObject.Name.MissileGroup, GameSprite.Name.NullObject, 0, 0.0f, 0.0f);

            pMissileGroup.ActivateGameSprite(pSB_Aliens);
            pMissileGroup.ActivateCollisionSprite(pSB_Box);
            GameObjectMan.Attach(pMissileGroup);

            //---------------------------------------------------------------------------------------------------------
            // Create Aliens
            //---------------------------------------------------------------------------------------------------------
            AlienGroup pAlienGroup;

            if (SceneStateGame.loadGhost == false)
            {
                GameObject pGameObj;
                AlienMan.Create();

                AlienFactory alienFactory = new AlienFactory(SpriteBatch.Name.Aliens, SpriteBatch.Name.Boxes);
                pAlienGroup = (AlienGroup)alienFactory.Create(GameObject.Name.AlienGroup, AlienCategory.Type.Group);

                for (int i = 0; i < 11; i++)
                {
                    float x = 100.0f + 35 * (i % 11);

                    GameObject pGameObjCol = alienFactory.Create(GameObject.Name.AlienColumn, AlienCategory.Type.Column, pAlienGroup);

                    pGameObj = alienFactory.Create(GameObject.Name.Squid, AlienCategory.Type.Squid, pGameObjCol, x, baseY);
                    pGameObj = alienFactory.Create(GameObject.Name.Crab, AlienCategory.Type.Crab, pGameObjCol, x, baseY - 30);
                    pGameObj = alienFactory.Create(GameObject.Name.Crab, AlienCategory.Type.Crab, pGameObjCol, x, baseY - 30 * 2);
                    pGameObj = alienFactory.Create(GameObject.Name.Octopus, AlienCategory.Type.Octopus, pGameObjCol, x, baseY - 30 * 3);
                    pGameObj = alienFactory.Create(GameObject.Name.Octopus, AlienCategory.Type.Octopus, pGameObjCol, x, baseY - 30 * 4);
                }
            }
            else
            {
                GameObjectNode pGhostGameObjNode = GhostGameObjectMan.Find(GameObject.Name.AlienGroup);

                pAlienGroup = (AlienGroup)pGhostGameObjNode.pGameObj;
                ForwardIterator pFor = new ForwardIterator(pAlienGroup);

                Component pNode = pFor.First();
                while (!pFor.IsDone())
                {
                    GameObject pGameObj = (GameObject)pNode;

                    pGameObj.ActivateGameSprite(pSB_Aliens);
                    pGameObj.ActivateCollisionSprite(pSB_Box);

                    pNode = pFor.Next();
                }
                GhostGameObjectMan.Remove(pGhostGameObjNode);
            }

            GameObjectMan.Attach(pAlienGroup);

            MovementSprite pMvSprite = new MovementSprite(pAlienGroup);

            pMvSprite.Attach(10.0f, 20.0f, new SndObserver(sndEngine, SndObserver.Name.AlienMove4, 0.5f));
            pMvSprite.Attach(10.0f, 20.0f, new SndObserver(sndEngine, SndObserver.Name.AlienMove3, 0.5f));
            pMvSprite.Attach(10.0f, 20.0f, new SndObserver(sndEngine, SndObserver.Name.AlienMove2, 0.5f));
            pMvSprite.Attach(10.0f, 20.0f, new SndObserver(sndEngine, SndObserver.Name.AlienMove1, 0.5f));
            TimerMan.Add(TimerEvent.Name.AlienMovement, pMvSprite, pMoveRate);

            //---------------------------------------------------------------------------------------------------------
            // UFO
            //---------------------------------------------------------------------------------------------------------
            UFORoot pUFORoot = new UFORoot(GameObject.Name.UFORoot, GameSprite.Name.NullObject, 0.0f, 0.0f);

            pUFORoot.ActivateCollisionSprite(pSB_Box);
            GameObjectMan.Attach(pUFORoot);
            UFOMan.Create(new SndObserver(sndEngine, SndObserver.Name.UFOFlyHigh, 0.2f, true));

            //---------------------------------------------------------------------------------------------------------
            // Shield
            //---------------------------------------------------------------------------------------------------------

            ShieldFactory shieldFactory = new ShieldFactory(SpriteBatch.Name.Shields, SpriteBatch.Name.Boxes);
            ShieldRoot    pShieldRoot   = (ShieldRoot)shieldFactory.Create(ShieldCategory.Type.Root, GameObject.Name.NullObject);

            GameObjectMan.Attach(pShieldRoot);

            // load by column
            for (int i = 0; i < 4; i++)
            {
                int   j           = 0;
                float start_x     = 86.0f + i * 146;
                float start_y     = 100.0f;
                float off_x       = 0;
                float brickWidth  = 10.0f;
                float brickHeight = 5.0f;

                ShieldGrid pShieldGrid = (ShieldGrid)shieldFactory.Create(ShieldCategory.Type.Grid, GameObject.Name.NullObject, pShieldRoot);

                GameObject pColumn;
                pColumn = shieldFactory.Create(ShieldCategory.Type.Column, GameObject.Name.ShieldColumn_0 + j++, pShieldGrid);

                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x, start_y);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + 2 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + 3 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + 4 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + 5 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + 6 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + 7 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.LeftTop1, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + 8 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.LeftTop0, GameObject.Name.ShieldBrick, pColumn, start_x, start_y + 9 * brickHeight);

                pColumn = shieldFactory.Create(ShieldCategory.Type.Column, GameObject.Name.ShieldColumn_0 + j++, pShieldGrid);

                off_x += brickWidth;
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 2 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 3 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 4 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 5 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 6 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 7 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 8 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 9 * brickHeight);

                pColumn = shieldFactory.Create(ShieldCategory.Type.Column, GameObject.Name.ShieldColumn_0 + j++, pShieldGrid);

                off_x += brickWidth;
                shieldFactory.Create(ShieldCategory.Type.LeftBottom, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 2 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 3 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 4 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 5 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 6 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 7 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 8 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 9 * brickHeight);

                pColumn = shieldFactory.Create(ShieldCategory.Type.Column, GameObject.Name.ShieldColumn_0 + j++, pShieldGrid);

                off_x += brickWidth;
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 3 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 4 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 5 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 6 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 7 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 8 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 9 * brickHeight);

                pColumn = shieldFactory.Create(ShieldCategory.Type.Column, GameObject.Name.ShieldColumn_0 + j++, pShieldGrid);

                off_x += brickWidth;
                shieldFactory.Create(ShieldCategory.Type.RightBottom, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 2 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 3 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 4 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 5 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 6 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 7 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 8 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 9 * brickHeight);

                pColumn = shieldFactory.Create(ShieldCategory.Type.Column, GameObject.Name.ShieldColumn_0 + j++, pShieldGrid);

                off_x += brickWidth;
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 0 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 1 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 2 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 3 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 4 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 5 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 6 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 7 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 8 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 9 * brickHeight);

                pColumn = shieldFactory.Create(ShieldCategory.Type.Column, GameObject.Name.ShieldColumn_0 + j++, pShieldGrid);

                off_x += brickWidth;
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 0 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 1 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 2 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 3 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 4 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 5 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 6 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.Brick, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 7 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.RightTop1, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 8 * brickHeight);
                shieldFactory.Create(ShieldCategory.Type.RightTop0, GameObject.Name.ShieldBrick, pColumn, start_x + off_x, start_y + 9 * brickHeight);
            }

            //---------------------------------------------------------------------------------------------------------
            // ColPair
            //---------------------------------------------------------------------------------------------------------

            // associate in a collision pair
            ColPair pColPair = ColPairMan.Add(ColPair.Name.Alien_Wall, pAlienGroup, pWallGroup);

            Debug.Assert(pColPair != null);
            pColPair.Attach(new GridObserver());
            //pColPair.Attach(new SndObserver(sndEngine, SndObserver.Name.Alien_Wall));

            // Missile vs Wall
            pColPair = ColPairMan.Add(ColPair.Name.Missile_Wall, pMissileGroup, pWallGroup);
            Debug.Assert(pColPair != null);
            pColPair.Attach(new ShipReadyObserver());
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new ExplosionObserver(explosionFactory, GameObject.Name.MissileDies, GameSprite.Name.MissileDies, pExplosionGroup, 1));


            // Bomb vs Bottom
            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Wall, pBombRoot, pWallGroup);
            pColPair.Attach(new BombObserver(1));
            pColPair.Attach(new RemoveBombObserver());
            pColPair.Attach(new ExplosionObserver(explosionFactory, GameObject.Name.BombDies, GameSprite.Name.BombDies, pExplosionGroup, 1));

            // UFO vs Wall
            pColPair = ColPairMan.Add(ColPair.Name.UFO_Wall, pUFORoot, pWallGroup);
            Debug.Assert(pColPair != null);
            pColPair.Attach(new RemoveUFOObserver());
            pColPair.Attach(new UFOReadyObserver(sndEngine));

            // Missle vs UFO
            pColPair = ColPairMan.Add(ColPair.Name.Missile_UFO, pMissileGroup, pUFORoot);
            Debug.Assert(pColPair != null);
            pColPair.Attach(new SndObserver(sndEngine, SndObserver.Name.Missile_Shield));
            pColPair.Attach(new RemoveUFOObserver2());
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new UFOReadyObserver(sndEngine));
            pColPair.Attach(new ScoreObserver());
            pColPair.Attach(new ShipReadyObserver());
            pColPair.Attach(new ExplosionObserver(explosionFactory, GameObject.Name.UFODies, GameSprite.Name.UFODies, pExplosionGroup, 2));

            // missile vs alien
            pColPair = ColPairMan.Add(ColPair.Name.Alien_Missile, pMissileGroup, pAlienGroup);
            pColPair.Attach(new ShipReadyObserver());
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new ScoreObserver());
            pColPair.Attach(new ExplosionObserver(explosionFactory, GameObject.Name.AlienDies, GameSprite.Name.AlienDies, pExplosionGroup, 2));
            pColPair.Attach(new GridRemoveAlienObserver());
            pColPair.Attach(new SndObserver(sndEngine, SndObserver.Name.Missile_Alien));
            pColPair.Attach(new AlienNumObserver(sndEngine));

            // Missile vs Shield
            pColPair = ColPairMan.Add(ColPair.Name.Misslie_Shield, pMissileGroup, pShieldRoot);
            pColPair.Attach(new SndObserver(sndEngine, SndObserver.Name.Missile_Shield));
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new RemoveBrickObserver());
            pColPair.Attach(new ShipReadyObserver());
            pColPair.Attach(new ExplosionObserver(explosionFactory, GameObject.Name.MissileDies, GameSprite.Name.MissileDies, pExplosionGroup, 1));

            // Bomb vs Shield
            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Shield, pBombRoot, pShieldRoot);
            pColPair.Attach(new SndObserver(sndEngine, SndObserver.Name.Bomb_Shield));
            pColPair.Attach(new BombObserver(1));
            pColPair.Attach(new RemoveBrickObserver());
            pColPair.Attach(new RemoveBombObserver());
            pColPair.Attach(new ExplosionObserver(explosionFactory, GameObject.Name.BombDies, GameSprite.Name.BombDies, pExplosionGroup, 1));

            // Bomb vs Ship pay attention to the order
            pColPair = ColPairMan.Add(ColPair.Name.Bomb_Ship, pBombRoot, pShipRoot);
            pColPair.Attach(new SndObserver(sndEngine, SndObserver.Name.Bomb_Ship));
            pColPair.Attach(new BombObserver(1));
            pColPair.Attach(new RemoveBombObserver());
            pColPair.Attach(new RemoveShipObserver());
            pColPair.Attach(new LifeObserver());
            pColPair.Attach(new AnimExplosionObserver(explosionFactory, GameObject.Name.ShipDies, GameSprite.Name.ShipDies, pExplosionGroup, 2));
            pColPair.Attach(new CreateShipObserver(sndEngine));

            // Ship vs Bumper
            pColPair = ColPairMan.Add(ColPair.Name.Ship_Bumper, pShipRoot, pBumperGroup);
            pColPair.Attach(new ShipMoveObserver());


            // Missle vs Bomb
            pColPair = ColPairMan.Add(ColPair.Name.Missile_Bomb, pMissileGroup, pBombRoot);
            Debug.Assert(pColPair != null);
            pColPair.Attach(new BombObserver(2));
            pColPair.Attach(new RemoveMissileObserver());
            pColPair.Attach(new RemoveBomb2Observer());
            pColPair.Attach(new ShipReadyObserver());
            pColPair.Attach(new ExplosionObserver(explosionFactory, GameObject.Name.MissileBombCol, GameSprite.Name.MissileBombCol, pExplosionGroup, 1));

            //---------------------------------------------------------------------------------------------------------
            // Input
            //---------------------------------------------------------------------------------------------------------

            InputSubject pInputSubject;

            pInputSubject = InputMan.GetArrowRightSubject();
            pInputSubject.Attach(new MoveRightObserver());

            pInputSubject = InputMan.GetArrowLeftSubject();
            pInputSubject.Attach(new MoveLeftObserver());

            pInputSubject = InputMan.GetSpaceSubject();
            pInputSubject.Attach(new ShootObserver());

            pInputSubject = InputMan.GetTSubject();
            pInputSubject.Attach(new ToggleObserver());

            pInputSubject = InputMan.GetRSubject();
            pInputSubject.Attach(new ToggleShieldObserver());

            Simulation.SetState(Simulation.State.Realtime);

            //---------------------------------------------------------------------------------------------------------
            // Font
            //---------------------------------------------------------------------------------------------------------
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "SCORE<1>", Glyph.Name.Consolas20pt, 100, 730);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "HI-SCORE", Glyph.Name.Consolas20pt, 300, 730);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "SCORE<2>", Glyph.Name.Consolas20pt, 500, 730);
            FontMan.Add(Font.Name.Score1, SpriteBatch.Name.Texts, score1, Glyph.Name.Consolas20pt, 100, 700);
            FontMan.Add(Font.Name.ScoreHigh, SpriteBatch.Name.Texts, scoreHigh, Glyph.Name.Consolas20pt, 300, 700);
            FontMan.Add(Font.Name.Score2, SpriteBatch.Name.Texts, score2, Glyph.Name.Consolas20pt, 500, 700);

            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "X", Glyph.Name.Consolas20pt, 80, 17);
            FontMan.Add(Font.Name.Life, SpriteBatch.Name.Texts, GetPlayerLife(GetCurrPlayer()).ToString(), Glyph.Name.Consolas20pt, 100, 17);

            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, "Player " + currPlayer.ToString(), Glyph.Name.Consolas20pt, 480, 17);
            FontMan.Add(Font.Name.TestMessage, SpriteBatch.Name.Texts, currPlayer == 1 ? "Level " + player1Level.ToString() : "Level " + player2Level.ToString(), Glyph.Name.Consolas20pt, 570, 17);

            //---------------------------------------------------------------------------------------------------------
            // State settings
            //---------------------------------------------------------------------------------------------------------
            SceneStateGame.SetLoadGhost(false);
        }
 public UFOReadyObserver(IrrKlang.ISoundEngine pEng)
 {
     this.pSndEngine = pEng;
 }
Beispiel #34
0
 public SoundObserver(IrrKlang.ISoundEngine eng, String mSoundName)
 {
     Debug.Assert(eng != null);
     this.soundEngine = eng;
     this.soundName   = mSoundName;
 }
Beispiel #35
0
        public override void Execute(float deltaTime, TimeEvent.Name name)
        {
            //if (Component.right > 896 || Component.left < 0.0f)
            //{
            //    Component.speed *= -1.0f;
            //    grid.MoveDown();
            //}
            //Component.right += Component.speed;
            //Component.left += Component.speed;
            grid.MoveGrid();

            IrrKlang.ISoundEngine pSndEngine = SpaceInvaders.GetInstance().sndEngine;
            pSndEngine.SoundVolume = 0.2f;
            if (counting % 4 == 0)
            {
                pSndEngine.Play2D("fastinvader1.wav");
            }
            else if (counting % 4 == 1)
            {
                pSndEngine.Play2D("fastinvader2.wav");
            }
            else if (counting % 4 == 2)
            {
                pSndEngine.Play2D("fastinvader3.wav");
            }
            else if (counting % 4 == 3)
            {
                pSndEngine.Play2D("fastinvader4.wav");
            }
            counting++;

            //1, using ForwardIterator
            ForwardIterator pIterator = new ForwardIterator(grid);
            Random          rnd       = new Random();
            int             num       = rnd.Next(0, 11);

            Debug.WriteLine("        random number generated: {0}", num);
            Component pColumn = null;
            bool      flag    = false;

            for (int i = 0; i <= num; i++)
            {
                if (pColumn == null && flag == true)
                {
                    break;
                }
                pColumn = pIterator.Next();
                flag    = true;
                if (pColumn == null)
                {
                    break;
                }
                while (pColumn.holder != Component.Container.COMPOSITE)
                {
                    pColumn = pIterator.Next();
                    if (pColumn == null)
                    {
                        break;
                    }
                }
            }



            //2, using Iterator
            //Component pColumn = Iterator.GetChild(grid);
            //pColumn = Iterator.GetSibling(pColumn);
            if (pColumn != null)
            {
                //Debug.WriteLine("  3,     child type: {0}", pColumn);
                Bomb pBomb = ((AlienColumn)pColumn).ActivateBomb(rnd);
                pBomb.ActivateGameSprite(this.pSpriteBatch);
                pBomb.ActivateCollisionSprite(this.pCollisionSpriteBatch);
                pTree.Add(pBomb);
            }


            // Add itself back to timer
            TimerMan.Add(name, this, deltaTime - 0.003f);
        }
Beispiel #36
0
 public SndObserver(IrrKlang.ISoundEngine pEng)
 {
     Debug.Assert(pEng != null);
     this.pSndEngine = pEng;
 }
 public SndObserver(IrrKlang.ISoundEngine pEng, string soundFileName)
 {
     Debug.Assert(pEng != null);
     this.pSndEngine    = pEng;
     this.soundFileName = soundFileName;
 }