//---------------------------------------------------------------------------------- // Methods //---------------------------------------------------------------------------------- public GameObject Create(GameObject.Name theName, WallCategory.Type type) { GameObject pGameObj = null; switch (type) { case WallCategory.Type.WallGroup: pGameObj = new WallGroup(theName, GameSprite.Name.NullObject, 0.0f, 0.0f); pGameObj.ActivateGameSprite(this.pSpriteBatch); pGameObj.ActivateCollisionSprite(this.pCollisionSpriteBatch); break; case WallCategory.Type.Left: pGameObj = new WallLeft(theName, GameSprite.Name.NullObject, 30.0f, 500.0f, 35.0f, 1000.0f); pGameObj.ActivateCollisionSprite(this.pCollisionSpriteBatch); break; case WallCategory.Type.Right: pGameObj = new WallRight(theName, GameSprite.Name.NullObject, 870.0f, 500.0f, 35.0f, 1000.0f); pGameObj.ActivateCollisionSprite(this.pCollisionSpriteBatch); break; case WallCategory.Type.Top: pGameObj = new WallTop(theName, GameSprite.Name.NullObject, 448, 950, 890, 50); pGameObj.ActivateCollisionSprite(this.pCollisionSpriteBatch); break; case WallCategory.Type.Bottom: pGameObj = new WallBottom(theName, GameSprite.Name.Wall, 448, 80, 890, 10); pGameObj.ActivateGameSprite(this.pSpriteBatch); pGameObj.ActivateCollisionSprite(this.pCollisionSpriteBatch); break; default: Debug.WriteLine("Choose the Wall you want by name."); Debug.Assert(false); break; } // add it to the Game Object Manager Debug.Assert(pGameObj != null); // Should only attach root elements to the GameObjectManager in the Scene // attach to the group in the switch statments because not all of them attach the same return(pGameObj); }
public GameObject Create(GameObject.Name name, WallCategory.Type type, float posX = 0.0f, float posY = 0.0f, float width = 0, float height = 0) { GameObject pGameObj = null; switch (type) { case WallCategory.Type.Wall_Left: pGameObj = new WallLeft(GameSprite.Name.Sprite_NullObject, name, posX, posY, width, height); break; case WallCategory.Type.Wall_Right: pGameObj = new WallRight(GameSprite.Name.Sprite_NullObject, name, posX, posY, width, height); break; case WallCategory.Type.Wall_Top: pGameObj = new WallTop(GameSprite.Name.Sprite_NullObject, name, posX, posY, width, height); break; case WallCategory.Type.Wall_Bottom: pGameObj = new WallBottom(GameSprite.Name.Sprite_NullObject, name, posX, posY, width, height); break; case WallCategory.Type.Wall_Grid: pGameObj = new WallGrid(name); break; default: // something is wrong Debug.Assert(false); break; } // add it to the gameObjectManager Debug.Assert(pGameObj != null); //GameObjectMan.Attach(pGameObj); // Attached to Group //pGameObj.ActivateGameSprite(this.pSpriteBatch); pGameObj.ActivateCollisionSprite(this.pBoxBatch); return(pGameObj); }
//~WallFactory() //{ // this.pSpriteBatch = null; //} public GameObject Create(WallCategory.Type type, GameObject.Name gameName, float posX = 0.0f, float posY = 0.0f, float width = 0.0f, float height = 0.0f) { GameObject pWall = null; switch (type) { case WallCategory.Type.Bottom: pWall = new WallBottom(gameName, GameSprite.Name.WallHorizontal, posX, posY, width, height); break; case WallCategory.Type.Top: pWall = new WallTop(gameName, GameSprite.Name.WallHorizontal, posX, posY, width, height); break; case WallCategory.Type.Left: pWall = new WallLeft(gameName, GameSprite.Name.WallVertical, posX, posY, width, height); break; case WallCategory.Type.Right: pWall = new WallRight(gameName, GameSprite.Name.WallVertical, posX, posY, width, height); break; case WallCategory.Type.WallGroup: pWall = new WallGroup(gameName, GameSprite.Name.NullObject, posX, posY); break; default: // something is wrong Debug.Assert(false); break; } // add to the tree this.pTree.Add(pWall); // Attached to Group pWall.ActivateGameSprite(this.pSpriteBatch); pWall.ActivateCollisionSprite(this.pCollisionSpriteBatch); return(pWall); }
//------------------------------------------------------------------------------- // Method //------------------------------------------------------------------------------- public GameObject create(GameObject.Name objectName, WallCategory.Type wallType, float posX = 0.0f, float posY = 0.0f, float width = 0.0f, float height = 0.0f) { GameObject pGameObject = null; switch (wallType) { case WallCategory.Type.WallGroup: pGameObject = new WallGroup(GameObject.Name.WallGroup, GameSprite.Name.NullObject, 0.0f, 0.0f); break; case WallCategory.Type.Left: pGameObject = new WallLeft(GameObject.Name.WallLeft, GameSprite.Name.NullObject, posX, posY, width, height); break; case WallCategory.Type.Right: pGameObject = new WallRight(GameObject.Name.WallRight, GameSprite.Name.NullObject, posX, posY, width, height); break; case WallCategory.Type.Top: pGameObject = new WallTop(GameObject.Name.WallTop, GameSprite.Name.NullObject, posX, posY, width, height); break; case WallCategory.Type.Bottom: pGameObject = new WallBottom(GameObject.Name.WallBottom, GameSprite.Name.NullObject, posX, posY, width, height); break; default: Debug.Assert(false); break; } Debug.Assert(pGameObject != null); pGameObject.activateGameSprite(this.pSpriteBatch); pGameObject.activateCollisionSprite(this.pBoxSpriteBatch); return(pGameObject); }
//--------------------------------------------------------- // Constructor //--------------------------------------------------------- protected WallCategory(GameObject.Name name, GameSprite.Name spriteName, WallCategory.Type type) : base(name, spriteName) { this.type = type; }
protected WallCategory(GameObject.Name name, GameSprite.Name spriteName, int index, WallCategory.Type wallType) : base(name, spriteName, index) { this.type = wallType; }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public WallCategory(GameObject.Name gameName, GameSprite.Name spriteName, WallCategory.Type wtype) : base(gameName, spriteName) { this.type = wtype; }