Beispiel #1
0
        public WallManager()
        {
            WallFactory gameSpaceFactory = new WallFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes);

            this.pGameSpace = (GameSpace)gameSpaceFactory.Create(GameObject.Type.GameSpace, 0, 0, 0, 0);
            Debug.Assert(this.pGameSpace != null);

            WallFactory wallFactory = new WallFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes, this.pGameSpace);

            this.pWallLeft = (WallLeft)wallFactory.Create(GameObject.Type.WallLeft, Constants.leftWallXPos, Constants.leftWallYPos,
                                                          Constants.leftWallWidth, Constants.leftWallHeight);
            Debug.Assert(this.pWallLeft != null);

            this.pWallRight = (WallRight)wallFactory.Create(GameObject.Type.WallRight, Constants.rightWallXPos, Constants.rightWallYPos,
                                                            Constants.rightWallWidth, Constants.rightWallHeight);
            Debug.Assert(this.pWallRight != null);

            this.pCeiling = (Ceiling)wallFactory.Create(GameObject.Type.Ceiling, Constants.ceilingXPos, Constants.ceilingYPos,
                                                        Constants.ceilingWidth, Constants.ceilingHeight);
            Debug.Assert(this.pCeiling != null);

            this.pFloor = (Floor)wallFactory.Create(GameObject.Type.Floor, Constants.floorXPos, Constants.floorYPos,
                                                    Constants.floorWidth, Constants.floorHeight);
            Debug.Assert(this.pFloor != null);
        }
Beispiel #2
0
        public override void VisitCeiling(Ceiling pCeiling)
        {
            //Debug.WriteLine("   --->DONE<----");
            ColPair pColPair = ColPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);

            pColPair.SetCollision(this, pCeiling);
            pColPair.NotifyListeners();
        }
Beispiel #3
0
        public GameObject Create(GameObject.Type type, float posX, float posY, float width, float height)
        {
            GameObject pGameObj = null;

            switch (type)
            {
            case GameObject.Type.GameSpace:
                pGameObj = new GameSpace(GameObject.Name.GameSpace, BoxSprite.Name.GameSpaceBox);
                break;

            case GameObject.Type.WallRight:
                pGameObj = new WallRight(GameObject.Name.WallRight, Sprite.Name.NullObject, BoxSprite.Name.WallBox, posX, posY, width, height);
                break;

            case GameObject.Type.WallLeft:
                pGameObj = new WallLeft(GameObject.Name.WallLeft, Sprite.Name.NullObject, BoxSprite.Name.WallBox, posX, posY, width, height);
                break;

            case GameObject.Type.Ceiling:
                pGameObj = new Ceiling(GameObject.Name.Ceiling, Sprite.Name.NullObject, BoxSprite.Name.WallBox, posX, posY, width, height);
                break;

            case GameObject.Type.Floor:
                pGameObj = new Floor(GameObject.Name.Floor, Sprite.Name.NullObject, BoxSprite.Name.WallBox, posX, posY, width, height);
                break;

            default:
                // something is wrong
                Debug.Assert(false, "GameObject type not supported by this factory");
                break;
            }

            // add it to the gameObjectManager
            Debug.Assert(pGameObj != null);
            GameObjectManager.Attach(pGameObj);

            if (pGOComposite != null)
            {
                // add to grid
                pGOComposite.Add(pGameObj);
            }

            // Attached to Batches
            this.pBoxSpriteBatch.Attach(pGameObj.poColObj.pColSprite);
            this.pSpriteBatch.Attach(pGameObj.pProxySprite);
            return(pGameObj);
        }
Beispiel #4
0
 public virtual void VisitCeiling(Ceiling pCeiling)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by Ceiling not implemented");
     Debug.Assert(false);
 }