public static void SelectGameObject(int id, GameObject.Type tagToAdd) { tag = tagToAdd; selectedID = id; trySelect = false; target = Target.GameObject; }
public TextureItem(Bitmap Img, GameObject.Type type) { img = Img; textureID = GameCore.CoreFiles.TextureIDs[type]; SizeX = img.Size.Width; SizeY = img.Size.Height; }
internal static void DeSelect() { trySelect = false; tag = GameObject.Type.Null; selectedID = -1; selectedTile = new Point(-1, -1); selectedTileSecond = new Point(-1, -1); tileObjects.Clear(); }
// Creates invader And adds it to Batches or gameobject manager public GameObject ActiveCreate(GameObject.Type type, float posX, float posY) { GameObject pGameObj = null; switch (type) { case GameObject.Type.SmallInvader: pGameObj = new SmallInvader(GameObject.Name.SmallInvader, Sprite.Name.SmallInvader, BoxSprite.Name.SmallInvaderBox, posX, posY); break; case GameObject.Type.MediumInvader: pGameObj = new MediumInvader(GameObject.Name.MediumInvader, Sprite.Name.MediumInvader, BoxSprite.Name.MediumInvaderBox, posX, posY); break; case GameObject.Type.LargeInvader: pGameObj = new LargeInvader(GameObject.Name.LargeInvader, Sprite.Name.LargeInvader, BoxSprite.Name.LargeInvaderBox, posX, posY); break; case GameObject.Type.UFO: pGameObj = new UFO(GameObject.Name.UFO, Sprite.Name.UFO, BoxSprite.Name.UFOBox, posX, posY); break; case GameObject.Type.InvaderColumn: pGameObj = new InvaderColumn(GameObject.Name.InvaderColumn, BoxSprite.Name.InvaderColumnBox); break; case GameObject.Type.InvaderGrid: pGameObj = new InvaderGrid(GameObject.Name.InvaderGrid, BoxSprite.Name.InvaderGridBox); 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 grouping pGOComposite.Add(pGameObj); } // Attached to Batches this.pBoxSpriteBatch.Attach(pGameObj.poColObj.pColSprite); this.pSpriteBatch.Attach(pGameObj.pProxySprite); return(pGameObj); }
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); }
// Creates invader but does not add it to Batches or gameobject manager public GameObject PassiveCreate(GameObject.Type type, float posX, float posY) { GameObject pGameObj = null; switch (type) { case GameObject.Type.SmallInvader: pGameObj = new SmallInvader(GameObject.Name.SmallInvader, Sprite.Name.SmallInvader, BoxSprite.Name.SmallInvaderBox, posX, posY); break; case GameObject.Type.MediumInvader: pGameObj = new MediumInvader(GameObject.Name.MediumInvader, Sprite.Name.MediumInvader, BoxSprite.Name.MediumInvaderBox, posX, posY); break; case GameObject.Type.LargeInvader: pGameObj = new LargeInvader(GameObject.Name.LargeInvader, Sprite.Name.LargeInvader, BoxSprite.Name.LargeInvaderBox, posX, posY); break; case GameObject.Type.UFO: pGameObj = new UFO(GameObject.Name.UFO, Sprite.Name.UFO, BoxSprite.Name.UFOBox, posX, posY); break; case GameObject.Type.InvaderColumn: pGameObj = new InvaderColumn(GameObject.Name.InvaderColumn, BoxSprite.Name.InvaderColumnBox); break; case GameObject.Type.InvaderGrid: pGameObj = new InvaderGrid(GameObject.Name.InvaderGrid, BoxSprite.Name.InvaderGridBox); break; default: // something is wrong Debug.Assert(false, "GameObject type not supported by this factory"); break; } if (pGOComposite != null) { // add to grouping pGOComposite.Add(pGameObj); } return(pGameObj); }
public void removeCallback(GameObject.Type typeA, GameObject.Type typeB, CallbackType callbackType) { switch (callbackType) { case CallbackType.BEGIN: callbacksBegin.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksBegin.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)); break; case CallbackType.DURING: callbacksDuring.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksDuring.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)); break; case CallbackType.END: callbacksEnd.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)); callbacksEnd.Remove(new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)); break; } }
public void addCallback(GameObject.Type typeA, GameObject.Type typeB, CollisionCallback callback, CallbackType callbackType) { switch (callbackType) { case CallbackType.BEGIN: callbacksBegin[new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)] = callback; callbacksBegin[new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)] = callback; break; case CallbackType.DURING: callbacksDuring[new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)] = callback; callbacksDuring[new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)] = callback; break; case CallbackType.END: callbacksEnd[new KeyValuePair <GameObject.Type, GameObject.Type>(typeA, typeB)] = callback; callbacksEnd[new KeyValuePair <GameObject.Type, GameObject.Type>(typeB, typeA)] = callback; break; } }
public Bitmap getTexture(GameObject.Type type) { return(LoadedTextures[type]); }