private static Ship ActivateShip(SpriteBatchMan pSpriteBatchMan) { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 150, 50); pShipMan.pShip = pShip; // Attach the sprite to the correct sprite batch SpriteBatch pSB_Aliens = pSpriteBatchMan.Find(SpriteBatch.Name.Aliens); pSB_Aliens.Attach(pShip.poProxySprite); SpriteBatch pSB_Box = pSpriteBatchMan.Find(SpriteBatch.Name.Boxes); pSB_Box.Attach(pShip.GetColObject().pColSprite); // Attach the missile to the missile root GameObject pShipRoot = GameObjectMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); // Add to GameObject Tree - {update and collisions} pShipRoot.Add(pShipMan.pShip); return(pShipMan.pShip); }
//similar to Activate Missile public static Ship ActivateShip() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 200, 60); pShipMan.poShip = pShip; GameObject pShipRoot = GONodeMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); pShipRoot.Add(pShipMan.poShip); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pShipMan.poShip.ActivateGameSprite(pSB_Aliens); pShipMan.poShip.ActivateCollisionSprite(pSB_Boxes); pShipMan.TakeLife(1); return(pShipMan.poShip); }
public static void Destroy() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); #if (TRACK_DESTRUCTOR_MAN) Debug.WriteLine("ShipMan.Destroy()"); #endif #if (TRACK_DESTRUCTOR_MAN) Debug.WriteLine(" {0} ({1})", ShipMan.instance, ShipMan.instance.GetHashCode()); #endif pShipMan.pStateReady = null; pShipMan.pStateMissileFlying = null; pShipMan.pStateEnd = null; pShipMan.pNoLeftState = null; pShipMan.pNoRightState = null; pShipMan.pFreeMoveState = null; pShipMan.poShip = null; pShipMan.pMissile = null; ShipMan.instance = null; }
public static MoveShipState GetMoveState(MoveState state) { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); MoveShipState pMoveState = null; switch (state) { case ShipMan.MoveState.NoLeft: pMoveState = pShipMan.pNoLeftState; break; case ShipMan.MoveState.FreeMove: pMoveState = pShipMan.pFreeMoveState; break; case ShipMan.MoveState.NoRight: pMoveState = pShipMan.pNoRightState; break; case ShipMan.MoveState.NoMove: pMoveState = pShipMan.pNoMoveState; break; default: Debug.Assert(false); break; } return(pMoveState); }
public static ShipState GetState(State state) { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); ShipState pShipState = null; switch (state) { case ShipMan.State.Ready: pShipState = pShipMan.pStateReady; break; case ShipMan.State.MissileFlying: pShipState = pShipMan.pStateMissileFlying; break; case ShipMan.State.End: pShipState = pShipMan.pStateEnd; break; default: Debug.Assert(false); break; } return(pShipState); }
private static Ship ActivateShip(SndObserver pSnd) { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 300, 55, pSnd); pShipMan.pShip = pShip; // Attach the sprite to the correct sprite batch //SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); //pSB_Aliens.Attach(pShip.pProxySprite); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pShip.ActivateCollisionSprite(pSB_Boxes); pShip.ActivateGameSprite(pSB_Aliens); // Attach the missile to the missile root GameObject pShipRoot = GameObjectMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); // Add to GameObject Tree - {update and collisions} pShipRoot.Add(pShipMan.pShip); return(pShipMan.pShip); }
public static Missile ActivateMissile() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 0, 0); pShipMan.pMissile = pMissile; // Attached to SpriteBatches SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pMissile.ActivateCollisionSprite(pSB_Boxes); pMissile.ActivateGameSprite(pSB_Aliens); // Attach the missile to the missile root GameObject pMissileGroup = GameObjectMan.Find(GameObject.Name.MissileGroup); Debug.Assert(pMissileGroup != null); // Add to GameObject Tree - {update and collisions} pMissileGroup.Add(pShipMan.pMissile); return(pShipMan.pMissile); }
public static Missile ActivateMissile() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy // TODO: This can be cleaned up more... no need to re-calling new() Missile pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 400, 100); pShipMan.pMissile = pMissile; // Attached to SpriteBatches SpriteNodeBatch pSB_Player = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Players); SpriteNodeBatch pSB_Boxes = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Boxes); pMissile.ActivateCollisionSprite(pSB_Boxes); pMissile.ActivateGameSprite(pSB_Player); // Attach the missile to the missile root GameObject pMissileGroup = GameObjectManager.Find(GameObject.Name.MissileGroup); Debug.Assert(pMissileGroup != null); // Add to GameObject Tree - {update and collisions} pMissileGroup.Add(pShipMan.pMissile); return(pShipMan.pMissile); }
private static Ship ActivateShip() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 400, 120); pShipMan.pShip = pShip; // Attach the sprite to the correct sprite batch SpriteNodeBatch pSB_Player = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Players); pSB_Player.Attach(pShip.pProxySprite); // Attach the missile to the missile root GameObject pShipRoot = GameObjectManager.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); // Add to GameObject Tree - {update and collisions} pShipRoot.Add(pShipMan.pShip); return(pShipMan.pShip); }
public static void DettachShip() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); pShipMan.pShip = null; }
public static Missile GetMissile() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); return(pShipMan.pMissile); }
public static Ship GetShip() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); return(pShipMan.pShip); }
public static void Attach(SpriteBatchMan pSpriteBatchMan) { ActivateShip(pSpriteBatchMan); ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); pShipMan.pShip.SetState(ShipMan.State.Ready); pShipMan.pSpriteBatchMan = pSpriteBatchMan; }
public static Missile ActivateMissile(Ship pShip) { Missile pMissile = pShip.GetMissile(); ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pMissile.ActivateCollisionSprite(pSB_Boxes); pMissile.ActivateGameSprite(pSB_Aliens); pMissile.pPlayer = pShip.pPlayer; GameObject pMissileGroup = GameObjectMan.Find(GameObject.Name.MissileGroup); Debug.Assert(pMissileGroup != null); pMissileGroup.Add(pMissile); return(pMissile); }
public static Ship ActivateShip() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Ship pShip = new Ship(GameObject.Name.Ship, GameSprite.Name.Ship, 300, 70); ShipMan.Add(pShip); // Attach the sprite to the correct sprite batch SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); pSB_Aliens.Attach(pShip.pProxySprite); GameObject pShipRoot = GameObjectMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); // Add to GameObject Tree - {update and collisions} pShipRoot.Add(pShip); return(pShip); }
public static Missile ActivateMissile() { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); pShipMan.pMissile = new Missile(GameObject.Name.Missile, GameSprite.Name.Missile, 10, 10); //attach missile to missile group(should be missileRoot) GameObject pMissileGroup = GONodeMan.Find(GameObject.Name.MissileGroup); Debug.Assert(pMissileGroup != null); pMissileGroup.Add(pShipMan.pMissile); SpriteBatch pSB_Projectiles = SpriteBatchMan.Find(SpriteBatch.Name.Projectiles); SpriteBatch pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes); pShipMan.pMissile.ActivateGameSprite(pSB_Projectiles); pShipMan.pMissile.ActivateCollisionSprite(pSB_Boxes); return(pShipMan.pMissile); }
public static Ship CreateInactiveShip(int xPos, int yPos) { ShipMan pShipMan = ShipMan.PrivInstance(); Debug.Assert(pShipMan != null); // copy over safe copy Ship pShip = new Ship(GameObject.Name.ShipInactive, GameSprite.Name.ShipInactive, xPos, yPos); pShip.SetState(ShipMan.State.Inactive); // Attach the sprite to the correct sprite batch SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens); pSB_Aliens.Attach(pShip.pProxySprite); GameObject pShipRoot = GameObjectMan.Find(GameObject.Name.ShipRoot); Debug.Assert(pShipRoot != null); pShipRoot.Add(pShip); GameObjectMan.Attach(pShip); return(pShip); }