public static void Remove(SpriteAnimation pNode)
        {
            SpriteAnimationManager pInstance = SpriteAnimationManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            Debug.Assert(pNode != null);
            pInstance.BaseRemove(pNode);
        }
        public static void Print()
        {
            SpriteAnimationManager pInstance = SpriteAnimationManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            Debug.WriteLine("******** SPRITE ANIMATION MANAGER ***********");
            pInstance.PrintStats();
            pInstance.PrintNodes();
        }
Esempio n. 3
0
 //-----------------------------------------------------------------------------
 // Game::UnLoadContent()
 //       unload content (resources loaded above)
 //       unload all content that was loaded before the Engine Loop started
 //-----------------------------------------------------------------------------
 public override void UnLoadContent()
 {
     FontManager.Destroy();
     GlyphManager.Destroy();
     CollisionPairManager.Destroy();
     SpriteAnimationManager.Destroy();
     SpriteBoxManager.Destroy();
     SpriteManager.Destroy();
     ImageManager.Destroy();
     TextureManager.Destroy();
 }
        public static void Destroy()
        {
            SpriteAnimationManager pInstance = SpriteAnimationManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            pInstance.BaseDestroy();

            pInstance.poNodeCompare          = null;
            SpriteAnimationManager.pInstance = null;
        }
        public static SpriteAnimation Find(SpriteAnimation.Name name)
        {
            SpriteAnimationManager pInstance = SpriteAnimationManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            // Use compare node to compare to search nodes
            pInstance.poNodeCompare.SetName(name);

            SpriteAnimation pData = (SpriteAnimation)pInstance.BaseFind(pInstance.poNodeCompare);

            return(pData);
        }
        public static SpriteAnimation Add(SpriteAnimation.Name animationName, Sprite.Name spriteName)
        {
            SpriteAnimationManager pMan = SpriteAnimationManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            SpriteAnimation pNode = (SpriteAnimation)pMan.BaseAdd();

            Debug.Assert(pNode != null);

            pNode.Set(animationName, spriteName);
            return(pNode);
        }
        //----------------------------------------------------------------------
        // Static Methods
        //----------------------------------------------------------------------
        public static void Create(int reserveNum = 3, int reserveGrow = 1)
        {
            // make sure values are ressonable
            Debug.Assert(reserveNum > 0);
            Debug.Assert(reserveGrow > 0);

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

            // Do the initialization
            if (pInstance == null)
            {
                pInstance = new SpriteAnimationManager(reserveNum, reserveGrow);
            }
        }
        public override void Execute(float deltaTime)
        {
            SpaceInvaders pGame = GameStateManager.GetGame();

            pGame.SetResetLevelFlag(false);

            // Ghost any remaining Shields
            ShieldGroup pShieldGroup = (ShieldGroup)GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.ShieldGroup);

            ShieldFactory.DestroyShields(pShieldGroup);

            // Ghost any remaining Aliens (Only necessary for Game reset)
            AlienGrid pAlienGrid = (AlienGrid)GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.AlienGrid);

            AlienFactory.DestroyAlienGrid(pAlienGrid);

            // Clear TimeEvents
            TimeEvent tEvent = TimerManager.Pop();

            while (tEvent != null)
            {
                // Kill any remaining TimerEvents
                tEvent = TimerManager.Pop();
            }

            // Recreate shields
            GameObject pShield;

            pShield = ShieldFactory.RecreateShield(110, 150);
            pShieldGroup.Add(pShield);
            pShield = ShieldFactory.RecreateShield(310, 150);
            pShieldGroup.Add(pShield);
            pShield = ShieldFactory.RecreateShield(510, 150);
            pShieldGroup.Add(pShield);
            pShield = ShieldFactory.RecreateShield(710, 150);
            pShieldGroup.Add(pShield);

            // Adjust Starting Speed
            float newStartingSpeed = pGame.GetStateLevelInitialAlienGridSpeed() - 0.05f;

            pGame.SetStateLevelInitialAlienGridSpeed(newStartingSpeed);
            pGame.SetStateAlienGridSpeed(newStartingSpeed);

            // Adjust Starting Position
            float newStartingYPosition = pGame.GetStateLevelInitialAlienGridYPosition() - 40.0f;

            pGame.SetStateLevelInitialAlienGridYPosition(newStartingYPosition);

            // Recreate AlienGrid
            AlienFactory.RecreateAlienGrid(pAlienGrid, newStartingSpeed, GameStateManager.GetGame().GetGameInitialGridXPosition(), newStartingYPosition);

            pGame.GetStateGameObjectManager().Print();
            pGame.GetStateSpriteBatchManager().Print();

            // Queue up Time Events
            QueuedTimeEventManager qtem = pGame.GetStateQueuedTimeEventManager();

            qtem.Enqueue(TimeEvent.Name.AlienGridMovementSound, new AlienGridMovementSound(), newStartingSpeed);
            qtem.Enqueue(TimeEvent.Name.SpriteAnimation, SpriteAnimationManager.Find(SpriteAnimation.Name.SquidAlien), newStartingSpeed);
            qtem.Enqueue(TimeEvent.Name.SpriteAnimation, SpriteAnimationManager.Find(SpriteAnimation.Name.CrabAlien), newStartingSpeed);
            qtem.Enqueue(TimeEvent.Name.SpriteAnimation, SpriteAnimationManager.Find(SpriteAnimation.Name.JellyfishAlien), newStartingSpeed);

            // Load Time Events into TimerManager
            QueuedTimeEvent qte = pGame.GetStateQueuedTimeEventManager().Dequeue();

            while (qte != null)
            {
                TimerManager.Add(qte.GetTimeEventName(), qte.GetCommand(), qte.GetTimeEventDelta());
                qte = pGame.GetStateQueuedTimeEventManager().Dequeue();
            }
        }
Esempio n. 9
0
        //-----------------------------------------------------------------------------
        // Game::LoadContent()
        //		Allows you to load all content needed for your engine,
        //	    such as objects, graphics, etc.
        //-----------------------------------------------------------------------------
        public override void LoadContent()
        {
            // Set to current state for initialization
            GameStateManager.GetGame().SetGameState(GameStateManager.GameState.Player1);

            //---------------------------------------------------------------------------------------------------------
            // Initialize State-Scoped Managers
            //---------------------------------------------------------------------------------------------------------

            this.pSpriteBatchManager     = new SpriteBatchManager(3, 1);
            this.pGameObjectManager      = new GameObjectManager(300, 10);
            this.pDelayedObjectManager   = new DelayedObjectManager();
            this.pQueuedTimeEventManager = new QueuedTimeEventManager(50, 5);
            this.pGhostManager           = new GhostManager(50, 5);
            this.pCompositeManager       = new CompositeManager(20, 2);


            //---------------------------------------------------------------------------------------------------------
            // Create Colors
            //---------------------------------------------------------------------------------------------------------

            pGreenColor = new Azul.Color(0.1137f, 0.8196f, 0.2667f, 1.0f);

            //---------------------------------------------------------------------------------------------------------
            // Create SpriteBatches
            //---------------------------------------------------------------------------------------------------------
            pCollisionBox_SpriteBatch = this.pSpriteBatchManager.Add(SpriteBatch.Name.CollisionBox);
            pCollisionBox_SpriteBatch.SetDraw(false);

            pWall_SpriteBatch         = this.pSpriteBatchManager.Add(SpriteBatch.Name.Wall);
            pAlien_SpriteBatch        = this.pSpriteBatchManager.Add(SpriteBatch.Name.Alien);
            pCoreCannon_SpriteBatch   = this.pSpriteBatchManager.Add(SpriteBatch.Name.CoreCannon);
            pMissile_SpriteBatch      = this.pSpriteBatchManager.Add(SpriteBatch.Name.Missile);
            pBomb_SpriteBatch         = this.pSpriteBatchManager.Add(SpriteBatch.Name.Bomb);
            pShield_SpriteBatch       = this.pSpriteBatchManager.Add(SpriteBatch.Name.Shield);
            pFlyingSaucer_SpriteBatch = this.pSpriteBatchManager.Add(SpriteBatch.Name.FlyingSaucer);
            pTexts_SpriteBatch        = this.pSpriteBatchManager.Add(SpriteBatch.Name.Player1Texts);

            //---------------------------------------------------------------------------------------------------------
            // Flying Saucer
            //---------------------------------------------------------------------------------------------------------

            FlyingSaucerRoot pFlyingSaucerRoot = new FlyingSaucerRoot(Composite.CompositeName.FlyingSaucerRoot, 0.0f, 0.0f);

            pFlyingSaucerRoot.ActivateSprite(pFlyingSaucer_SpriteBatch);
            pFlyingSaucerRoot.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            this.pGameObjectManager.Attach(pFlyingSaucerRoot);
            this.pCompositeManager.Attach(pFlyingSaucerRoot);

            DeployFlyingSaucerCommand pDeployFlyingSaucer = new DeployFlyingSaucerCommand();

            this.pQueuedTimeEventManager.Enqueue(TimeEvent.Name.DeployFlyingSaucer, pDeployFlyingSaucer, r.Next(30, 46));

            //---------------------------------------------------------------------------------------------------------
            // Core Cannon
            //---------------------------------------------------------------------------------------------------------

            CoreCannonGroup pCoreCannonGroup = new CoreCannonGroup(Composite.CompositeName.CoreCannonGroup, 0.0f, 0.0f);

            this.pGameObjectManager.Attach(pCoreCannonGroup);
            this.pCompositeManager.Attach(pCoreCannonGroup);
            this.pCoreCannonManager = new CoreCannonManager();
            this.pCoreCannonManager.ActivateCoreCannon();

            //---------------------------------------------------------------------------------------------------------
            // Sprite Animations
            //---------------------------------------------------------------------------------------------------------

            // Squid Alien
            this.pQueuedTimeEventManager.Enqueue(TimeEvent.Name.SpriteAnimation, SpriteAnimationManager.Find(SpriteAnimation.Name.SquidAlien), 0.8f);

            // Crab Alien
            this.pQueuedTimeEventManager.Enqueue(TimeEvent.Name.SpriteAnimation, SpriteAnimationManager.Find(SpriteAnimation.Name.CrabAlien), 0.8f);

            // JellyFish Alien
            this.pQueuedTimeEventManager.Enqueue(TimeEvent.Name.SpriteAnimation, SpriteAnimationManager.Find(SpriteAnimation.Name.JellyfishAlien), 0.8f);

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

            BombRoot pBombRoot = new BombRoot(Composite.CompositeName.BombRoot, 0.0f, 0.0f);

            pBombRoot.ActivateSprite(pBomb_SpriteBatch);
            //pBombRoot.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            this.pCompositeManager.Attach(pBombRoot);
            this.pGameObjectManager.Attach(pBombRoot);

            // Add initial drop bomb events
            this.pQueuedTimeEventManager.Enqueue(TimeEvent.Name.DropBomb, new DropBombCommand(), 1.0f);
            this.pQueuedTimeEventManager.Enqueue(TimeEvent.Name.DropBomb, new DropBombCommand(), 3.0f);

            //---------------------------------------------------------------------------------------------------------
            // Missile
            //---------------------------------------------------------------------------------------------------------

            MissileGroup pMissileGroup = new MissileGroup(Composite.CompositeName.MissileGroup, 0.0f, 0.0f);

            pMissileGroup.ActivateSprite(pMissile_SpriteBatch);
            pMissileGroup.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            this.pGameObjectManager.Attach(pMissileGroup);
            this.pCompositeManager.Attach(pMissileGroup);

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

            // Wall Root
            pWallGroup = new WallGroup(GameObject.Name.ShieldGroup, Sprite.Name.NullSprite, 0.0f, 0.0f);
            pWallGroup.ActivateSprite(pWall_SpriteBatch);
            pWallGroup.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            LeftWall pLeftWall = new LeftWall(GameObject.Name.LeftWall, Sprite.Name.NullSprite, 20, 425, 15, 800);

            pLeftWall.ActivateSprite(pWall_SpriteBatch);
            pLeftWall.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            RightWall pRightWall = new RightWall(GameObject.Name.RightWall, Sprite.Name.NullSprite, 875, 425, 15, 800);

            pRightWall.ActivateSprite(pWall_SpriteBatch);
            pRightWall.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            TopWall pTopWall = new TopWall(GameObject.Name.TopWall, Sprite.Name.NullSprite, 450, 825, 870, 15);

            pTopWall.ActivateSprite(pWall_SpriteBatch);
            pTopWall.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            BottomWall pBottomWall = new BottomWall(GameObject.Name.BottomWall, Sprite.Name.NullSprite, 450, 55, 870, 15);

            pBottomWall.ActivateSprite(pWall_SpriteBatch);
            pBottomWall.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            LeftBumper pLeftBumper = new LeftBumper(GameObject.Name.LeftBumper, Sprite.Name.NullSprite, 45, 100, 30, 50);

            pLeftBumper.ActivateSprite(pWall_SpriteBatch);
            pLeftBumper.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            RightBumper pRightBumper = new RightBumper(GameObject.Name.RightBumper, Sprite.Name.NullSprite, 850, 100, 30, 50);

            pRightBumper.ActivateSprite(pWall_SpriteBatch);
            pRightBumper.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            pWallGroup.Add(pLeftWall);
            pWallGroup.Add(pRightWall);
            pWallGroup.Add(pTopWall);
            pWallGroup.Add(pBottomWall);
            pWallGroup.Add(pLeftBumper);
            pWallGroup.Add(pRightBumper);

            this.pCompositeManager.Attach(pWallGroup);
            this.pGameObjectManager.Attach(pWallGroup);
            this.pGameObjectManager.Attach(pLeftWall);
            this.pGameObjectManager.Attach(pRightWall);
            this.pGameObjectManager.Attach(pTopWall);
            this.pGameObjectManager.Attach(pBottomWall);
            this.pGameObjectManager.Attach(pLeftBumper);
            this.pGameObjectManager.Attach(pRightBumper);

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

            //Shield Root
            ShieldGroup pShieldGroup = new ShieldGroup(Composite.CompositeName.ShieldGroup, 0.0f, 0.0f);

            pShieldGroup.ActivateSprite(pShield_SpriteBatch);
            pShieldGroup.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            GameObject pShield;

            pShield = ShieldFactory.CreateShield(110, 150);
            pShieldGroup.Add(pShield);
            pShield = ShieldFactory.CreateShield(310, 150);
            pShieldGroup.Add(pShield);
            pShield = ShieldFactory.CreateShield(510, 150);
            pShieldGroup.Add(pShield);
            pShield = ShieldFactory.CreateShield(710, 150);
            pShieldGroup.Add(pShield);

            this.pGameObjectManager.Attach(pShieldGroup);
            this.pCompositeManager.Attach(pShieldGroup);


            //---------------------------------------------------------------------------------------------------------
            // Create Alien Grid Composite
            //---------------------------------------------------------------------------------------------------------

            this.levelInitialAlienGridSpeed = SpaceInvadersGameState.gameInitialAlienGridSpeed;
            this.currAlienGridSpeed         = SpaceInvadersGameState.gameInitialAlienGridSpeed;

            this.currLevelInitialAlienGridY = SpaceInvadersGameState.gameInitialAlienGridY;

            pAlienGrid = (Composite)AlienFactory.CreateAlienGrid(SpaceInvadersGameState.gameInitialAlienGridX, currLevelInitialAlienGridY);

            // Add Initial AlienGridMovementSound Event
            AlienGridMovementSound pAlienGridMovementSound = new AlienGridMovementSound();

            this.pQueuedTimeEventManager.Enqueue(TimeEvent.Name.AlienGridMovementSound, pAlienGridMovementSound, levelInitialAlienGridSpeed);

            //---------------------------------------------------------------------------------------------------------
            // Associate Collision Pairs
            //---------------------------------------------------------------------------------------------------------

            // Alien vs Missile
            CollisionPair pAlienMissileColPair = CollisionPairManager.Add(CollisionPair.Name.Alien_Missile, pAlienGrid, pMissileGroup);

            Debug.Assert(pAlienMissileColPair != null);
            pAlienMissileColPair.Attach(new ShipReadyObserver());
            pAlienMissileColPair.Attach(new RemoveMissileObserver());
            pAlienMissileColPair.Attach(new RemoveAlienObserver());
            pAlienMissileColPair.Attach(new AddPlayerPointsObserver(Player.Name.Player1));
            pAlienMissileColPair.Attach(new InvaderKilledSoundObserver());

            // FlyingSaucer vs Missile
            CollisionPair pFlyingSaucerMissileColPair = CollisionPairManager.Add(CollisionPair.Name.FlyingSaucer_Missile, pFlyingSaucerRoot, pMissileGroup);

            Debug.Assert(pFlyingSaucerMissileColPair != null);
            pFlyingSaucerMissileColPair.Attach(new ShipReadyObserver());
            pFlyingSaucerMissileColPair.Attach(new RemoveMissileObserver());
            pFlyingSaucerMissileColPair.Attach(new RemoveFlyingSaucerObserver());
            pFlyingSaucerMissileColPair.Attach(new ExplosionSoundObserver());

            // FlyingSaucer vs Wall
            CollisionPair pFlyingSaucerWallColPair = CollisionPairManager.Add(CollisionPair.Name.FlyingSaucer_Wall, pFlyingSaucerRoot, pWallGroup);

            Debug.Assert(pFlyingSaucerWallColPair != null);
            pFlyingSaucerWallColPair.Attach(new RemoveFlyingSaucerObserver());

            // Alien vs Wall
            CollisionPair pAlienWallColPair = CollisionPairManager.Add(CollisionPair.Name.Alien_Wall, pAlienGrid, pWallGroup);

            Debug.Assert(pAlienWallColPair != null);
            pAlienWallColPair.Attach(new GridWallCollisionObserver());

            // Alien vs Shield
            CollisionPair pAlienShieldColPair = CollisionPairManager.Add(CollisionPair.Name.Alien_Shield, pAlienGrid, pShieldGroup);

            Debug.Assert(pAlienShieldColPair != null);
            pAlienShieldColPair.Attach(new RemoveShieldBrickObserver());

            // Missile vs Wall
            CollisionPair pMissileWallColPair = CollisionPairManager.Add(CollisionPair.Name.Missile_Wall, pMissileGroup, pWallGroup);

            Debug.Assert(pMissileWallColPair != null);
            pMissileWallColPair.Attach(new ShipReadyObserver());
            pMissileWallColPair.Attach(new RemoveMissileObserver());

            // Missile vs Shield
            CollisionPair pMissileShieldColPair = CollisionPairManager.Add(CollisionPair.Name.Missile_Shield, pMissileGroup, pShieldGroup);

            Debug.Assert(pMissileShieldColPair != null);
            pMissileShieldColPair.Attach(new ShipReadyObserver());
            pMissileShieldColPair.Attach(new RemoveMissileObserver());
            pMissileShieldColPair.Attach(new RemoveShieldBrickObserver());

            // Bomb vs Shield
            CollisionPair pBombShieldColPair = CollisionPairManager.Add(CollisionPair.Name.Bomb_Shield, pBombRoot, pShieldGroup);

            Debug.Assert(pBombShieldColPair != null);
            pBombShieldColPair.Attach(new RemoveBombObserver());
            pBombShieldColPair.Attach(new RemoveShieldBrickObserver());

            // Bomb vs Wall
            CollisionPair pBombWallColPair = CollisionPairManager.Add(CollisionPair.Name.Bomb_Wall, pBombRoot, pWallGroup);

            Debug.Assert(pBombWallColPair != null);
            pBombWallColPair.Attach(new RemoveBombObserver());

            // CoreCannon vs Bumpers
            CollisionPair pCoreCannonWallColPair = CollisionPairManager.Add(CollisionPair.Name.CoreCannon_Wall, pCoreCannonGroup, pWallGroup);

            Debug.Assert(pCoreCannonWallColPair != null);
            pCoreCannonWallColPair.Attach(new CoreCannonBumperCollisionObserver());

            // Bomb vs Missile
            CollisionPair pBombMissileColPair = CollisionPairManager.Add(CollisionPair.Name.Bomb_Missile, pBombRoot, pMissileGroup);

            Debug.Assert(pBombMissileColPair != null);
            pBombMissileColPair.Attach(new ShipReadyObserver());
            pBombMissileColPair.Attach(new RemoveBombObserver());
            pBombMissileColPair.Attach(new RemoveMissileObserver());

            // Bomb vs CoreCannon
            CollisionPair pBombShipColPair = CollisionPairManager.Add(CollisionPair.Name.Bomb_Ship, pBombRoot, pCoreCannonGroup);

            Debug.Assert(pBombShipColPair != null);
            pBombShipColPair.Attach(new PlayerDeathObserver(Player.Name.Player1));
            pBombShipColPair.Attach(new RemoveBombObserver());
            pBombShipColPair.Attach(new ExplosionSoundObserver());

            //---------------------------------------------------------------------------------------------------------
            // Fonts
            //---------------------------------------------------------------------------------------------------------
            FontManager.Add(Font.Name.Player1Lives, pTexts_SpriteBatch, "LIVES " + GameStateManager.GetGame().GetPlayer(Player.Name.Player1).GetNumLives().ToString(), Glyph.Name.Consolas36pt, 50, 50);
        }
Esempio n. 10
0
        //-----------------------------------------------------------------------------
        // Game::LoadContent()
        //		Allows you to load all content needed for your engine,
        //	    such as objects, graphics, etc.
        //-----------------------------------------------------------------------------
        public override void LoadContent()
        {
            // Initialize Game State Attributes
            hiScore       = 0;
            numCredits    = 0;
            twoPlayerMode = false;
            player1       = new Player(Player.Name.Player1);
            player2       = new Player(Player.Name.Player2);

            //---------------------------------------------------------------------------------------------------------
            // Manager initialization
            //---------------------------------------------------------------------------------------------------------
            TextureManager.Create(3, 1);
            ImageManager.Create(10, 2);
            SpriteManager.Create(10, 2);
            SpriteBoxManager.Create(20, 2);
            SpriteProxyManager.Create(50, 5);
            SpriteAnimationManager.Create(10, 2);
            TimerManager.Create(50, 10);
            CollisionPairManager.Create(10, 2);
            GlyphManager.Create(3, 1);
            FontManager.Create(5, 1);
            SoundEngineManager.Create();
            //---------------------------------------------------------------------------------------------------------
            // Initialize Game-Scoped Non-Singleton Managers
            //---------------------------------------------------------------------------------------------------------

            this.pGameSpriteBatchManager = new SpriteBatchManager(3, 1);

            //---------------------------------------------------------------------------------------------------------
            // Create Colors
            //---------------------------------------------------------------------------------------------------------

            pRedColor   = new Azul.Color(0.9019f, 0.0784f, 0.0784f, 1.0f);
            pGreenColor = new Azul.Color(0.1137f, 0.8196f, 0.2667f, 1.0f);

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

            TextureManager.Add(Texture.Name.Aliens, "Aliens.tga");
            TextureManager.Add(Texture.Name.Shield, "Shield.tga");
            TextureManager.Add(Texture.Name.Consolas20pt, "Consolas20pt.tga");
            TextureManager.Add(Texture.Name.Consolas36pt, "Consolas36pt.tga");

            //---------------------------------------------------------------------------------------------------------
            // Load the Fonts
            //---------------------------------------------------------------------------------------------------------

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

            //---------------------------------------------------------------------------------------------------------
            // Create Images
            //---------------------------------------------------------------------------------------------------------

            // Aliens
            ImageManager.Add(Image.Name.OpenJellyfishAlien, Texture.Name.Aliens, 47.0f, 23.0f, 185.0f, 121.0f);
            ImageManager.Add(Image.Name.ClosedJellyfishAlien, Texture.Name.Aliens, 51.0f, 178.0f, 178.0f, 120.0f);
            ImageManager.Add(Image.Name.OpenCrabAlien, Texture.Name.Aliens, 316.0f, 24.0f, 167.0f, 119.0f);
            ImageManager.Add(Image.Name.ClosedCrabAlien, Texture.Name.Aliens, 316.0f, 179.0f, 167.0f, 119.0f);
            ImageManager.Add(Image.Name.OpenSquidAlien, Texture.Name.Aliens, 608.0f, 25.0f, 127.0f, 120.0f);
            ImageManager.Add(Image.Name.ClosedSquidAlien, Texture.Name.Aliens, 611.0f, 178.0f, 122.0f, 119.0f);
            ImageManager.Add(Image.Name.FlyingSaucer, Texture.Name.Aliens, 80.0f, 500.0f, 223.0f, 105.0f);

            // Shields
            ImageManager.Add(Image.Name.Brick, Texture.Name.Shield, 174, 110, 10, 5);
            ImageManager.Add(Image.Name.BrickLeft_Top0, Texture.Name.Shield, 153, 94, 10, 5);
            ImageManager.Add(Image.Name.BrickLeft_Top1, Texture.Name.Shield, 153, 99, 10, 5);
            ImageManager.Add(Image.Name.BrickLeft_Bottom, Texture.Name.Shield, 173, 129, 10, 5);
            ImageManager.Add(Image.Name.BrickRight_Top0, Texture.Name.Shield, 213, 94, 10, 5);
            ImageManager.Add(Image.Name.BrickRight_Top1, Texture.Name.Shield, 213, 99, 10, 5);
            ImageManager.Add(Image.Name.BrickRight_Bottom, Texture.Name.Shield, 193, 129, 10, 5);

            // Bombs
            ImageManager.Add(Image.Name.BombStraight, Texture.Name.Aliens, 378, 798, 15, 98);
            ImageManager.Add(Image.Name.BombZigZag, Texture.Name.Aliens, 574, 643, 42, 99);
            ImageManager.Add(Image.Name.BombCross, Texture.Name.Aliens, 112, 798, 42, 84);

            // Other
            ImageManager.Add(Image.Name.CoreCannon, Texture.Name.Aliens, 51.0f, 332.0f, 192.0f, 120.0f);
            ImageManager.Add(Image.Name.Missle, Texture.Name.Aliens, 419.0f, 699.0f, 16.0f, 58.0f);

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

            // Aliens
            SpriteManager.Add(Sprite.Name.JellyfishAlien, Image.Name.OpenJellyfishAlien, 100.0f, 0.0f, 48.0f, 33.0f);
            SpriteManager.Add(Sprite.Name.CrabAlien, Image.Name.OpenCrabAlien, 100.0f, 200.0f, 45.0f, 30.0f);
            SpriteManager.Add(Sprite.Name.SquidAlien, Image.Name.OpenSquidAlien, 300.0f, 200.0f, 33.0f, 30.0f);
            SpriteManager.Add(Sprite.Name.FlyingSaucer, Image.Name.FlyingSaucer, 400.0f, 500.0f, 58.0f, 28.0f, pRedColor);

            SpriteManager.Add(Sprite.Name.GiantCrabAlien, Image.Name.OpenCrabAlien, 100.0f, 200.0f, 180.0f, 120.0f, pGreenColor);

            // Shields
            SpriteManager.Add(Sprite.Name.Brick, Image.Name.Brick, 50, 25, 12, 6);
            SpriteManager.Add(Sprite.Name.Brick_LeftTop0, Image.Name.BrickLeft_Top0, 50, 25, 12, 6);
            SpriteManager.Add(Sprite.Name.Brick_LeftTop1, Image.Name.BrickLeft_Top1, 50, 25, 12, 6);
            SpriteManager.Add(Sprite.Name.Brick_LeftBottom, Image.Name.BrickLeft_Bottom, 50, 25, 12, 6);
            SpriteManager.Add(Sprite.Name.Brick_RightTop0, Image.Name.BrickRight_Top0, 50, 25, 12, 6);
            SpriteManager.Add(Sprite.Name.Brick_RightTop1, Image.Name.BrickRight_Top1, 50, 25, 12, 6);
            SpriteManager.Add(Sprite.Name.Brick_RightBottom, Image.Name.BrickRight_Bottom, 50, 25, 12, 6);

            // Bombs
            SpriteManager.Add(Sprite.Name.BombZigZag, Image.Name.BombZigZag, 200, 200, 10, 20);
            SpriteManager.Add(Sprite.Name.BombStraight, Image.Name.BombStraight, 100, 100, 5, 20);
            SpriteManager.Add(Sprite.Name.BombCross, Image.Name.BombCross, 100, 100, 10, 20);

            // Other
            SpriteManager.Add(Sprite.Name.CoreCannon, Image.Name.CoreCannon, 400.0f, 40.0f, 50.0f, 30.0f, pGreenColor);
            SpriteManager.Add(Sprite.Name.Missile, Image.Name.Missle, 400.0f, 70.0f, 4.0f, 14.0f);

            //---------------------------------------------------------------------------------------------------------
            // Sprite Animations
            //---------------------------------------------------------------------------------------------------------

            // Squid Alien
            SpriteAnimation pSquidAnimation = SpriteAnimationManager.Add(SpriteAnimation.Name.SquidAlien, Sprite.Name.SquidAlien);

            pSquidAnimation.Attach(Image.Name.ClosedSquidAlien);
            pSquidAnimation.Attach(Image.Name.OpenSquidAlien);

            // Crab Alien
            SpriteAnimation pCrabAnimation = SpriteAnimationManager.Add(SpriteAnimation.Name.CrabAlien, Sprite.Name.CrabAlien);

            pCrabAnimation.Attach(Image.Name.ClosedCrabAlien);
            pCrabAnimation.Attach(Image.Name.OpenCrabAlien);

            // JellyFish Alien
            SpriteAnimation pJellyfishAnimation = SpriteAnimationManager.Add(SpriteAnimation.Name.JellyfishAlien, Sprite.Name.JellyfishAlien);

            pJellyfishAnimation.Attach(Image.Name.ClosedJellyfishAlien);
            pJellyfishAnimation.Attach(Image.Name.OpenJellyfishAlien);

            //---------------------------------------------------------------------------------------------------------
            // Create Game-Scoped SpriteBatches
            //---------------------------------------------------------------------------------------------------------
            pGameTexts_SpriteBatch = this.pGameSpriteBatchManager.Add(SpriteBatch.Name.GameTexts);

            FontManager.Add(Font.Name.Player1ScoreTitle, pGameTexts_SpriteBatch, "SCORE <1>", Glyph.Name.Consolas36pt, 50, 825);
            FontManager.Add(Font.Name.Player2ScoreTitle, pGameTexts_SpriteBatch, "SCORE <2>", Glyph.Name.Consolas36pt, 650, 825);
            FontManager.Add(Font.Name.HighScoreTitle, pGameTexts_SpriteBatch, "HI-SCORE", Glyph.Name.Consolas36pt, 350, 825);
            FontManager.Add(Font.Name.Player1Score, pGameTexts_SpriteBatch, GameStateManager.GetGame().GetPlayer(Player.Name.Player1).GetPoints().ToString("D4"), Glyph.Name.Consolas36pt, 80, 775);
            FontManager.Add(Font.Name.Player2Score, pGameTexts_SpriteBatch, GameStateManager.GetGame().GetPlayer(Player.Name.Player2).GetPoints().ToString("D4"), Glyph.Name.Consolas36pt, 680, 775);
            FontManager.Add(Font.Name.HighScore, pGameTexts_SpriteBatch, GameStateManager.GetGame().GetHiScore().ToString("D4"), Glyph.Name.Consolas36pt, 380, 775);

            FontManager.Add(Font.Name.GameCredits, pGameTexts_SpriteBatch, "CREDIT " + GameStateManager.GetGame().GetNumCredits(), Glyph.Name.Consolas36pt, 650, 50);

            //---------------------------------------------------------------------------------------------------------
            // Load State-specific content
            //---------------------------------------------------------------------------------------------------------

            GameStateManager.GetState(GameStateManager.GameState.Attract).LoadContent();
            GameStateManager.GetState(GameStateManager.GameState.Player1).LoadContent();
            GameStateManager.GetState(GameStateManager.GameState.Player2).LoadContent();
            GameStateManager.GetState(GameStateManager.GameState.End).LoadContent();

            // Game State -- Initialize in Attract mode
            this.pGameState = GameStateManager.GetState(GameStateManager.GameState.Attract);
            this.AttachStateInputObservers();
        }