public static Bomb ActiveBomb() { //ensure call Create() first BombMan pMan = BombMan.GetInstance(); Debug.Assert(pMan != null); GameSprite.Name spriteName = GameSprite.Name.BombDagger + pMan.randNum.Next(3); FallStrategy pFallStrategy = pMan.chooseFallStrategy(spriteName); Debug.Assert(pFallStrategy != null); // create Bomb Bomb pBomb = new Bomb(GameObject.Name.Bomb, spriteName, pFallStrategy, 100, 100); // activate collision sprite and game sprite pBomb.activateGameSprite(SpriteBatchMan.Find(SpriteBatch.Name.Bombs)); pBomb.activateCollisionSprite(SpriteBatchMan.Find(SpriteBatch.Name.Boxes)); //attach Bomb to BombGroup GameObject pBombGroup = GameObjectMan.Find(GameObject.Name.BombGroup); Debug.Assert(pBombGroup != null); // add to GameObject pBombGroup.add(pBomb); return(pBomb); }
private static BombMan GetInstance() { if (_BombMan == null) { _BombMan = new BombMan(); } return(_BombMan); }
public override void dropBomb(AlienCategory pAlien) { Bomb pBomb = BombMan.ActiveBomb(); pBomb.setPos(pAlien.x + 5, pAlien.y - 40); pBomb.setShooter(pAlien); // switch states this.handle(pAlien); }
//--------------------------------------------------------- // Static methods //--------------------------------------------------------- public static void Create() { Debug.Assert(pInstance == null); if (pInstance == null) { pInstance = new BombMan(); } Debug.Assert(pInstance != null); }
public void Shoot() { AliensCol shootingCol = (AliensCol)Iterator.GetChild(this); int size = children.Size(); int col = Rand.GetNext(1, size); if (Iterator.GetSibling(shootingCol) != null) { for (int i = 0; i < col; i++) { shootingCol = (AliensCol)Iterator.GetSibling(shootingCol); } BombMan.InitializeBomb(shootingCol.x, shootingCol.y - shootingCol.CollisionObj.Rect.height / 2 - 10); } }
public static void Initialize() { _BombMan = GetInstance(); }
public void dropBomb() { Bomb pBomb = BombMan.ActiveBomb(); pBomb.setPos(this.x + 5, this.y - 40); }
//------------------------------------------------------------------------------- // Methods //------------------------------------------------------------------------------- public void create(Manager.Name managerName, int reserveNum = 3, int growNum = 1) { switch (managerName) { case Manager.Name.TextureMan: TextureMan.Create(reserveNum, growNum); break; case Manager.Name.ImageMan: ImageMan.Create(reserveNum, growNum); break; case Manager.Name.GameSpriteMan: GameSpriteMan.Create(reserveNum, growNum); break; case Manager.Name.BoxSpriteMan: BoxSpriteMan.Create(reserveNum, growNum); break; case Manager.Name.SpriteBatchMan: SpriteBatchMan.Create(reserveNum, growNum); break; case Manager.Name.TimerMan: TimerMan.Create(reserveNum, growNum); break; case Manager.Name.ProxySpriteMan: ProxySpriteMan.Create(reserveNum, growNum); break; case Manager.Name.GameObjectMan: GameObjectMan.Create(reserveNum, growNum); break; case Manager.Name.CollisionPairMan: CollisionPairMan.Create(reserveNum, growNum); break; case Manager.Name.GlyphMan: GlyphMan.Create(reserveNum, growNum); break; case Manager.Name.FontMan: FontMan.Create(reserveNum, growNum); break; case Manager.Name.ShipMan: ShipMan.Create(); break; case Manager.Name.BombMan: BombMan.Create(); break; case Manager.Name.SoundMan: SoundMan.Create(); break; case Manager.Name.AlienMan: AlienMan.Create(); break; case Manager.Name.UFOMan: UFOMan.Create(); break; case Manager.Name.SceneMan: SceneMan.Create(); break; default: Debug.Assert(false); break; } }