public static void InitializeBomb(float x, float y) { // get Bomb Group BombCol BCol = (BombCol)GameObjectMan.Find(0, 10).GameObj; // if bullet is in the object pool if (BCol.Reservedchildren.GetHead() != null) { _BombMan.Bomb = (BombLeaf)BCol.Reservedchildren.GetHead(); BCol.Reservedchildren.Remove(_BombMan.Bomb); UpdateBombPos(x, y); _BombMan.Bomb.ResetStrategy(); // next line is necessary PlayBatchMan.Find(BatchName.Box).Add(GetBomb().CollisionObj.Box); PlayBatchMan.Find(BatchName.Box).Add(BCol.CollisionObj.Box); } else // if bullet is not in the object pool. create new Bullet Obj { GetRandomBomb(); UpdateBombPos(x, y); } BCol.Add(GetBomb()); }
public static void KillAll() { DLinkedNode Child = GetGrid().GetFirstChild(); while (Child != null) { // Kill all Child DLinkedNode NextChild = Child.Next; // Kill all grand Child DLinkedNode GrandChild = ((AliensCol)Child).GetFirstChild(); while (GrandChild != null) { DLinkedNode NextGrandChild = GrandChild.Next; AlienLeaf tempGrandChild = ((AlienLeaf)GrandChild); ((AliensCol)Child).Remove(tempGrandChild); // Remove ProxySprite add Box Obj PlayBatchMan.Find(BatchName.Aliens).Remove(((AlienLeaf)GrandChild).GetProxy()); PlayBatchMan.Find(BatchName.Box).Remove(((AlienLeaf)GrandChild).CollisionObj.Box); GrandChild = NextGrandChild; } GetGrid().Remove((AliensCol)Child); // Remove Box Obj PlayBatchMan.Find(BatchName.Box).Remove(((AliensCol)Child).CollisionObj.Box); Child = NextChild; } }
public static void InitializeGrid() { // get Alien Grid From ReservedChildren Group AliensGrid Grid = (AliensGrid)GameObjectMan.Find(0, 0).GameObj; //if Grid has Child in the object pool DLinkedNode Col = Grid.Reservedchildren.GetHead(); if (Col != null) { ResetGrid(Grid); // Update xs and ys of the whole grid UpdateGridPos(60, 530 - 30 * Nums.Level); // next line is necessary PlayBatchMan.Find(BatchName.Box).Add(GetGrid().CollisionObj.Box); } else { // if Aliens Grid is not in the object pool. create new Grid Obj for (int j = 1; j <= 11; j++) { Composite col = AlienObjectFactory.CreatComposite(j); Grid.Add(col); } } _AlienGridMan._AlienGrid = Grid; }
private static PlayBatchMan GetInstance(int t = 4, int d = 1) { if (_batchManager == null) { _batchManager = new PlayBatchMan(t, d); } return(_batchManager); }
public ShipCol(int lx, int ly) { CollisionObj = new CollisionObject(); CollisionObj.Box.SetColor(1, 1, 0, 1); PlayBatchMan.Find(BatchName.Box).Add(CollisionObj.Box); locationX = lx; locationY = ly; }
public WallLeaf(int x, int y, int w, int h, int lx, int ly) { CollisionObj = new CollisionObject(); CollisionObj.UpdateCollisionObject(new CollisionRect(new Azul.Rect(x, y, w, h))); CollisionObj.Box.SetColor(1, 1, 1, 1); PlayBatchMan.Find(BatchName.Box).Add(CollisionObj.Box); locationX = lx; locationY = ly; }
public BombLeaf(GameSpriteName spname, FallStrategy strategy, float x, float y, int lx, int ly) { proxySprite = new ProxySprite(spname, x, y); CollisionObj = new CollisionObject(proxySprite); PlayBatchMan.Find(BatchName.Box).Add(CollisionObj.Box); this.x = x; this.y = y; _Strategy = strategy; _Strategy.Reset(this.y); }
public ShipBulletLeaf(GameSpriteName spname, float x, float y, int lx, int ly) { proxySprite = new ProxySprite(spname, x, y); CollisionObj = new CollisionObject(proxySprite); PlayBatchMan.Find(BatchName.Box).Add(CollisionObj.Box); this.x = x; this.y = y; locationX = lx; locationY = ly; }
public ShieldBrick(GameSpriteName spname, float x, float y, int lx, int ly) { proxySprite = new ProxySprite(spname, x, y); CollisionObj = new CollisionObject(proxySprite); PlayBatchMan.Find(BatchName.Box).Add(CollisionObj.Box); // set obj Green proxySprite.GetSprite().SetColor(0, 1, 0); this.x = x; this.y = y; locationX = lx; locationY = ly; }
public static void KillAll() { BombCol BCol = (BombCol)GameObjectMan.Find(0, 10).GameObj; DLinkedNode Child = BCol.GetFirstChild(); while (Child != null) { // Kill all Child DLinkedNode NextChild = Child.Next; BCol.Remove((BombLeaf)Child); // Remove Box Obj PlayBatchMan.Find(BatchName.Box).Remove(((BombLeaf)Child).CollisionObj.Box); PlayBatchMan.Find(BatchName.Bombs).Remove(((BombLeaf)Child).GetProxy()); Child = NextChild; } }
public static void InitialUFO() { UFOCol UCol = (UFOCol)GameObjectMan.Find(50, 50).GameObj; if (UCol.Reservedchildren.GetHead() != null) { _UFOMan.UFO = (UFOLeaf)UCol.Reservedchildren.GetHead(); UCol.Reservedchildren.Remove(GetUFO()); UpdateUFOPos(); PlayBatchMan.Find(BatchName.Box).Add(GetUFO().CollisionObj.Box); PlayBatchMan.Find(BatchName.Box).Add(UCol.CollisionObj.Box); } else { _UFOMan.UFO = new UFOLeaf(GameSpriteName.UFO, 400, 200, 50, 6); UpdateUFOPos(); } UCol.Add(_UFOMan.UFO); }
private static void UpdateGridPos(float x, float y) { for (DLinkedNode Child = (AliensCol)GetGrid().GetFirstChild(); Child != null; Child = Child.Next) { // Alien Col do not have to update position, Since they will be updated By GameObjMan.Update() // Only add Box Obj to Box batch PlayBatchMan.Find(BatchName.Box).Add(((AliensCol)Child).CollisionObj.Box); // Alien leaf can be updated by their relative location for (DLinkedNode GrandChild = ((AliensCol)Child).GetFirstChild(); GrandChild != null; GrandChild = GrandChild.Next) { AlienLeaf tempGrandChild = ((AlienLeaf)GrandChild); tempGrandChild.x = x + 40 * tempGrandChild.locationX; tempGrandChild.y = y - 30 * tempGrandChild.locationY; tempGrandChild.CollisionObj.UpdatePos(tempGrandChild.x, tempGrandChild.y); // Update ProxySprite add Box Obj to batch PlayBatchMan.Find(BatchName.Aliens).Add(((AlienLeaf)GrandChild).GetProxy()); PlayBatchMan.Find(BatchName.Box).Add(((AlienLeaf)GrandChild).CollisionObj.Box); } } }
public static void InitializeBullet() { // get Bullet Group ShipBulletCol BulletCol = (ShipBulletCol)GameObjectMan.Find(200, 100).GameObj; // if bullet is in the object pool if (BulletCol.Reservedchildren.GetHead() != null) { _ShipMan.BulletLeaf = (ShipBulletLeaf)BulletCol.Reservedchildren.GetHead(); BulletCol.Reservedchildren.Remove(_ShipMan.BulletLeaf); UpdateBulletPos(); // next line is necessary PlayBatchMan.Find(BatchName.Box).Add(GetShipBulletLeaf().CollisionObj.Box); PlayBatchMan.Find(BatchName.Box).Add(BulletCol.CollisionObj.Box); } else // if bullet is not in the object pool. create new Bullet Obj { _ShipMan.BulletLeaf = new ShipBulletLeaf(GameSpriteName.ShipBullet, 400, 100, 200, 101); UpdateBulletPos(); } BulletCol.Add(GetShipBulletLeaf()); }
public static void InitializeShip() { // get Ship Group ShipCol ShipC = (ShipCol)GameObjectMan.Find(200, 200).GameObj; // if Ship is in the object pool if (ShipC.Reservedchildren.GetHead() != null) { _ShipMan.Ship = (ShipLeaf)ShipC.Reservedchildren.GetHead(); ShipC.Reservedchildren.Remove(GetShip()); UpdateShipPos(); // next line is necessary PlayBatchMan.Find(BatchName.Box).Add(GetShip().CollisionObj.Box); PlayBatchMan.Find(BatchName.Box).Add(ShipC.CollisionObj.Box); } else // if Ship is not in the object pool. create new Bullet Obj { _ShipMan.Ship = new ShipLeaf(GameSpriteName.Ship, 400, 100, 200, 201); UpdateShipPos(); } GetShip().SetState(StateName.Ready); ShipC.Add(GetShip()); }
//----------------------------------------------------------------------------- // Game::LoadContent() // Allows you to load all content needed for your engine, // such as objects, graphics, etc. //----------------------------------------------------------------------------- public override void LoadContent() { //--------------------------------------------------------------------------------------------------------- // Initialize managers //--------------------------------------------------------------------------------------------------------- // Initialize and Add All Texture TextureMan.Initialize(); TextureMan.AddAll(); // Initialize and Add All image ImageMan.Initialize(); ImageMan.AddAll(); // Initialize and Add All Sprites GameSpriteMan.Initialize(); GameSpriteMan.AddAll(); // Initialize and Add All Sounds SoundMan.Initialize(); SoundMan.AddAll(); // Initialize Input and Output GlyphMan.Initialize(); GlyphMan.AddXml(GlyphName.Consolas36pt, "Consolas36pt.xml", TextureName.Consolas); FontMan.Initialize(); InputMan.Initialize(); // Initialize TimerEvents TimerMan.Initialize(); // Initialize GameObj and Collision PlayBatchMan.Initialize(); // ***** Scene ***** SceneContext.Initialize(); }
private static void UpdateBombPos(float x, float y) { PlayBatchMan.Find(BatchName.Bombs).Add(GetBomb().GetProxy()); GetBomb().SetPos(x, y); GetBomb().CollisionObj.UpdatePos(x, y); }
public static void Initialize() { _batchManager = GetInstance(); }
private static void UpdateBulletPos() { PlayBatchMan.Find(BatchName.ShipBullet).Add(GetShipBulletLeaf().GetProxy()); GetShipBulletLeaf().SetPos(GetShip().x, GetShip().y + 20); GetShipBulletLeaf().CollisionObj.UpdatePos(GetShip().x, GetShip().y + 20); }
private static void UpdateShipPos() { PlayBatchMan.Find(BatchName.Ship).Add(GetShip().GetProxy()); GetShip().SetPos(400, 100); GetShip().CollisionObj.UpdatePos(400, 100); }
private static void UpdateUFOPos() { PlayBatchMan.Find(BatchName.UFO).Add(GetUFO().GetProxy()); GetUFO().SetPos(100, 200); GetUFO().CollisionObj.UpdatePos(100, 200); }