Example #1
0
        static public ColPair GetActiveColPair()
        {
            // get the singleton
            ColPairManager pMan = ColPairManager.PrivGetInstance();

            return(pMan.pActiveColPair);
        }
Example #2
0
        // Should be called at some point before leaving state
        public override void CleanUp(GameManager pGameManager)
        {
            GameManager.PushHighScoreToFont();

            ShipManager.Purge();

            TimerManager.PurgeAllNodes();
            GameObjectManager.PurgeAllNodes();

            SpriteBatch pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes);

            pSBatch.GetSBNodeManager().PurgeAllNodes();
            pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Sprites);
            pSBatch.GetSBNodeManager().PurgeAllNodes();

            ColPairManager.PurgeAllNodes();

            DelayedObjectManager.PurgeAll();

            InputSubject pInputSubject = InputManager.GetArrowLeftSubject();

            pInputSubject.PurgeAll();

            pInputSubject = InputManager.GetArrowRightSubject();
            pInputSubject.PurgeAll();

            pInputSubject = InputManager.GetSpaceSubject();
            pInputSubject.PurgeAll();


            Handle(pGameManager);
        }
        public override void ReinitializeLevel(GameManager pGameManager)
        {
            SoundManager.StopAllSounds();

            TimerManager.PurgeAllNodes();
            GameObjectManager.PurgeAllNodes();
            SpriteBatch pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes);

            pSBatch.GetSBNodeManager().PurgeAllNodes();
            pSBatch = SpriteBatchManager.Find(SpriteBatch.Name.Sprites);
            pSBatch.GetSBNodeManager().PurgeAllNodes();
            ColPairManager.PurgeAllNodes();
            DelayedObjectManager.PurgeAll();

            if (pGameManager.pActivePlayer.name == PlayerArtifact.Name.PlayerOne)
            {
                PlayerOneInit(pGameManager);
                pGameManager.poPlayer1.RestoreManagerStates(pGameManager.pGame.GetTime());
                pGameManager.SetActivePlayer(PlayerArtifact.Name.PlayerOne);
            }
            else
            {
                PlayerTwoInit(pGameManager);
                pGameManager.poPlayer2.RestoreManagerStates(pGameManager.pGame.GetTime());
                pGameManager.SetActivePlayer(PlayerArtifact.Name.PlayerTwo);
            }
        }
 public override void Execute()
 {
     // Let the gameObject deal with this...
     //Debug.WriteLine("*** KILLING " + this.pColPair + " ***");
     ColPairManager.Remove(this.pColPair);
     //ColPairManager.PrintReport();
 }
Example #5
0
        public static void PullFromMemento(ManagerMemento pMemento)
        {
            ColPairManager pMan = ColPairManager.PrivGetInstance();

            Debug.Assert(pMan != null);
            pMan.BasePullFromMemento(pMemento);
        }
Example #6
0
        public override void VisitBomb(Bomb b)
        {
            //Debug.WriteLine(" ---> Done");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            pColPair.SetCollision(b, this);
            pColPair.NotifyListeners();
        }
Example #7
0
        public static void PurgeAllNodes()
        {
            ColPairManager pMan = ColPairManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.BasePurgeAllNodes();
        }
Example #8
0
        public static void DumpLists()
        {
            ColPairManager pMan = privGetInstance();

            Debug.Assert(pMan != null);

            Debug.WriteLine("------ CollisionPair Manager Dump Lists------");
            pMan.baseDumpLists();
        }
Example #9
0
        public override void VisitBomb(Bomb pBomb)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            pColPair.SetCollision(pBomb, this);
            pColPair.NotifyListeners();
        }
Example #10
0
        public override void VisitInvaderCategory(InvaderCategory pInvader)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            pColPair.SetCollision(this, pInvader);
            pColPair.NotifyListeners();
        }
Example #11
0
        public override void VisitMissile(Missile m)
        {
            // Missile vs WallTop
            //Debug.WriteLine(" ---> Done");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            pColPair.SetCollision(m, this);
            pColPair.NotifyListeners();
        }
Example #12
0
        public override void VisitWallRight(WallRight pWallRight)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            pColPair.SetCollision(this, pWallRight);
            pColPair.NotifyListeners();
        }
Example #13
0
        public override void VisitBomb(Bomb b)
        {
            //Bomb vs ShieldBrick
            //Debug.WriteLine(" -------> END COLLISION: AlienBomb vs ShieldBrick <---------");
            ColPair collisionPair = ColPairManager.GetActiveColPair();

            collisionPair.SetCollision(b, this);
            collisionPair.NotifyListeners();
        }
Example #14
0
        //-----------------------------------------------------------------------------
        // Game::Update()
        //      Called once per frame, update data, tranformations, etc
        //      Use this function to control process order
        //      Input, AI, Physics, Animation, and Graphics
        //-----------------------------------------------------------------------------
        public override void Update()
        {
            //check time;
            //Debug.WriteLine("Simulation.GetTimeStep()  = {0}", Simulation.GetTimeStep());
            //Debug.WriteLine("Simulation.GetTotalTime() = {0}", Simulation.GetTotalTime());



            //Update game simulation
            // Single Step, Free running...
            Simulation.Update(this.GetTime());

            //always update input asap
            InputManager.Update();

            // Run based on simulation stepping
            if (Simulation.GetTimeStep() > 0.0f)
            {
                // Fire off the timer events

                //with simulator timer
                TimerEventManager.Update(Simulation.GetTotalTime());
                ////no simulator timer
                //TimerEventManager.Update(this.GetTime());


                // Do the collision checks
                ColPairManager.Process();

                //GameObjectManager updates ALL game objects and sprite positions
                // remember each game object has a proxy sprite attached
                GameObjectManager.Update();

                GridManager.UpdateBombDrop();
            }


            ////Original, No Simulation ---------------------------------------------------

            ////always update input asap
            //InputMan.Update();

            //// Fire off the timer events
            //TimerMan.Update(this.GetTime());

            //// Do the collision checks
            //ColPairMan.Process();

            ////GameObjectManager updates ALL game objects and sprite positions
            //// remember each game object has a proxy sprite attached
            //// walk through all objects and push to flyweight
            //GameObjectMan.Update();

            //// Delete any objects here...
            //DelayedObjectMan.Process();
        }
Example #15
0
        public static void Remove(ColPair pNode)
        {
            //get the singleton
            ColPairManager pMan = privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemoveNode(pNode);
        }
Example #16
0
        public override void VisitFloor(Floor pFloor)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            // Always set Bomb as ObjB
            pColPair.SetCollision(pFloor, this);
            pColPair.NotifyListeners();
        }
Example #17
0
        public override void VisitShip(Ship pShip)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            // Always set ship as ObjB
            pColPair.SetCollision(this, pShip);
            pColPair.NotifyListeners();
        }
Example #18
0
        public override void VisitMissile(Missile pMissile)
        {
            //Debug.WriteLine("in brick   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            // Always set missile as ObjA
            pColPair.SetCollision(pMissile, this);
            pColPair.NotifyListeners();
        }
        public override void VisitShieldBrick(ShieldBrick pShieldBrick)
        {
            //Debug.WriteLine("in InvaderCategory   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);

            pColPair.SetCollision(this, pShieldBrick);
            pColPair.NotifyListeners();
        }
Example #20
0
        public override void VisitWallLeft(WallLeft pWallLeft)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            // Always set Grid as ObjB
            pColPair.SetCollision(pWallLeft, this);
            pColPair.NotifyListeners();
        }
Example #21
0
        public override void VisitInvaderGrid(InvaderGrid pGrid)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            // Always set grid as ObjB
            pColPair.SetCollision(this, pGrid);
            pColPair.NotifyListeners();
        }
Example #22
0
        public static void Destroy()
        {
            // Get the instance
            ColPairManager pMan = ColPairManager.privGetInstance();

            #if (TRACK_DESTRUCTOR)
            Debug.WriteLine("--->ColPairManager.Destroy()");
            #endif
            pMan.baseDestroy();
        }
Example #23
0
        public static void Remove(ColPair pNode)
        {
            ColPairManager pMan = ColPairManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);

            pMan.BaseRemove(pNode);
        }
Example #24
0
        public override void VisitShieldBrick(ShieldBrick pShieldBrick)
        {
            //Debug.WriteLine("in Missile   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            // Always set missile as ObjA
            pColPair.SetCollision(this, pShieldBrick);
            pColPair.NotifyListeners();
        }
Example #25
0
        public override void VisitBomb(Bomb pBomb)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            // Always set missile as ObjA
            // Always set Bomb as ObjB
            pColPair.SetCollision(this, pBomb);
            pColPair.NotifyListeners();
        }
Example #26
0
        public static ColPair Find(ColPair.Name name, int index = 0)
        {
            //get the singleton
            ColPairManager pMan = ColPairManager.privGetInstance();

            // Compare functions only compares two Nodes
            pMan.pRefNode.SetName(name);

            ColPair pData = (ColPair)pMan.baseFindNode(pMan.pRefNode);

            return(pData);
        }
        public void RestoreManagerStates(float currTime)
        {
            TimerManager.PullFromMemento(this.pTimerMemento, currTime);
            GameObjectManager.PullFromMemento(this.pGameObjectMemento);
            ColPairManager.PullFromMemento(this.pColPairMemento);

            SpriteBatch pSpriteBatch = SpriteBatchManager.Find(SpriteBatch.Name.Sprites);

            pSpriteBatch.GetSBNodeManager().PullFromMemento(this.pSpritesSBNodeMemento);
            pSpriteBatch = SpriteBatchManager.Find(SpriteBatch.Name.Boxes);
            pSpriteBatch.GetSBNodeManager().PullFromMemento(this.pSpriteBoxesSBNodeMemento);
        }
Example #28
0
        public override void VisitMissile(Missile m)
        {
            // AlienOctopus vs Missile
            ColPair collisionPair = ColPairManager.GetActiveColPair();

            collisionPair.SetCollision(m, this);
            collisionPair.NotifyListeners();
            //    Debug.WriteLine("collide: {0} with {1}", this, m);

            Debug.WriteLine("-------> Done  <--------");

            //m.hit = true;
        }
Example #29
0
        public static void PrintReport()
        {
            Debug.WriteLine("--------------------------------------------------------------------------------");
            Debug.WriteLine("-------------------------------- ColPair Manager -------------------------------");
            Debug.WriteLine("--------------------------------------------------------------------------------");

            ColPairManager pMan = ColPairManager.PrivGetInstance();

            Debug.Assert(pMan != null);
            Debug.WriteLine("ACTIVE COLPAIR: {0}", pMan.pActiveColPair);

            pMan.BasePrintReport();
        }
Example #30
0
        public static ColPair Find(ColPair.Name name)
        {
            ColPairManager pMan = ColPairManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.poCompareNode.name = name;

            ColPair pData = (ColPair)pMan.BaseFind(pMan.poCompareNode);

            Debug.Assert(pData != null);

            return(pData);
        }