public static void DropBomb() { UFOManager ufoMan = UFOManager.GetInstance(); UFO ufo = ufoMan.pUFO; PCSTree pcsTree = GameObjectManager.GetRootTree(); Debug.Assert(pcsTree != null); Bomb pBomb = new Bomb(GameObjectName.UFOBomb, SpriteBaseName.UFOBomb, new FallStraight(), ufo.x, ufo.y, 0); pBomb.pProxySprite.pSprite.SetColor(ColorFactory.Create(ColorName.Red).pAzulColor); ufoMan.pBomb = pBomb; SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); pBomb.ActivateCollisionSprite(sbBoxes); pBomb.ActivateGameSprite(sbAliens); GameObject pBombRoot = GameObjectManager.Find(GameObjectName.BombRoot); Debug.Assert(pBombRoot != null); pcsTree.Insert(ufoMan.pBomb, pBombRoot); SetUFOBombActive(true); Debug.WriteLine("UFO Bomb dropped!"); }
public static Missile ActivateMissile() { ShipManager shipMan = ShipManager.GetInstance(); PCSTree pcsTree = GameObjectManager.GetRootTree(); Debug.Assert(pcsTree != null); Missile pMissile = new Missile(GameObjectName.Missile, SpriteBaseName.Missile, 400.0f, 100.0f, 0); pMissile.pProxySprite.pSprite.SetColor(ColorFactory.Create(ColorName.Green).pAzulColor); shipMan.pMissile = pMissile; SpriteBatch sbAliens = SpriteBatchManager.Find(SpriteBatchName.Aliens); SpriteBatch sbBoxes = SpriteBatchManager.Find(SpriteBatchName.Boxes); pMissile.ActivateCollisionSprite(sbBoxes); pMissile.ActivateGameSprite(sbAliens); GameObject pMissileRoot = GameObjectManager.Find(GameObjectName.MissileRoot); Debug.Assert(pMissileRoot != null); pcsTree.Insert(shipMan.pMissile, pMissileRoot); return(shipMan.pMissile); }
public ShieldBrick(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx) : base(goName, sName, ShieldType.Brick, idx) { this.x = x; this.y = y; this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.White).pAzulColor; }
public WallRight(GameObjectName goName, SpriteBaseName sName, float x, float y, float w, float h, int idx) : base(goName, sName, WallType.Right, idx) { this.pCollisionObject.pCollisionRect.Set(x, y, w, h); this.x = x; this.y = y; this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Yellow).pAzulColor; }
public Column(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx, Random pRandom) : base(goName, sName, AlienType.Column, idx) { this.x = x; this.y = y; this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Green).pAzulColor; this.alienCount = 0; }
public MissileRoot(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx) : base(goName, sName, MissileType.MissileRoot, idx) { this.x = x; this.y = y; this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Red).pAzulColor; }
public Splat(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx) : base(goName, sName, AlienType.Splat, idx) { this.x = x; this.y = y; this.pProxySprite.x = x; this.pProxySprite.y = y; this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Black).pAzulColor; }
public UFO(GameObjectName goName, SpriteBaseName sName, UFOStrategy strat, float x, float y) : base(goName, sName, UFOType.UFO, 0) { this.x = x; this.y = y; this.speed = 4.0f; this.pStrategy = strat; this.pProxySprite.pSprite.pColor = ColorFactory.Create(ColorName.Red).pAzulColor; }
public Explosion(GameObjectName goName, SpriteBaseName sName, AlienType alienType, GameObject go, ColorName color, int idx) : base(goName, sName, alienType, idx) { this.x = go.x; this.y = go.y; this.pProxySprite.x = x; this.pProxySprite.y = y; this.pProxySprite.pSprite.SetColor(ColorFactory.Create(color).pAzulColor); }
public Ship(GameObjectName goName, SpriteBaseName sName, float x, float y) : base(goName, sName, ShipType.Ship, 0) { this.x = x; this.y = y; this.state = null; this.speed = 5.0f; this.pProxySprite.pSprite.pColor = ColorFactory.Create(ColorName.Green).pAzulColor; this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Blue).pAzulColor; }
public Bomb(GameObjectName goName, SpriteBaseName sName, FallStrategy strat, float x, float y, int idx) : base(goName, sName, BombType.Bomb, idx) { this.x = x; this.y = y; this.speed = 5.0f; Debug.Assert(strat != null); this.fallStrategy = strat; this.fallStrategy.Reset(this.y); this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Orange).pAzulColor; }
public BombRoot(GameObjectName goName, SpriteBaseName sName, float x, float y, int idx) : base(goName, sName, BombType.BombRoot, idx) { this.x = x; this.y = y; SpriteBatch sb = new SpriteBatch(); SpriteBatchNode sbNode = new SpriteBatchNode(); sbNode.Set(SpriteManager.Find(SpriteBaseName.Null), sb); this.pProxySprite.SetSpriteBatchNode(sbNode); this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.White).pAzulColor; }
public CollisionObject(ProxySprite proxySprite) { // we'll pass in proxySprites to generate collision boxes around Debug.Assert(proxySprite != null); Sprite pSprite = proxySprite.pSprite; Debug.Assert(pSprite != null); this.pCollisionRect = new CollisionRect(pSprite.GetScreenRect()); //Debug.WriteLine("ProxySprite Rect for {0}:({1},{2}),w:{3},h:{4}", proxySprite.pSprite.name, proxySprite.x, proxySprite.y, proxySprite.pSprite.pScreenRect.width, proxySprite.pSprite.pScreenRect.height); //Debug.WriteLine("CollisionRect for {0}:({1},{2}),w:{3},h:{4}", proxySprite.pSprite.name, this.pCollisionRect.x, this.pCollisionRect.y, this.pCollisionRect.width, this.pCollisionRect.height); this.pCollisionSpriteBox = SpriteBoxManager.Add(SpriteBaseName.Box, this.pCollisionRect); Debug.Assert(this.pCollisionSpriteBox != null); this.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Red).pAzulColor; }
public SpriteBox() : base() { this.name = SpriteBaseName.Uninitialized; this.pAzulSpriteBox = new Azul.SpriteBox(); this.pLineColor = ColorFactory.Create(ColorName.White).pAzulColor; this.pScreenRect = new Azul.Rect(); this.x = 0.0f; this.y = 0.0f; this.sx = 1.0f; this.sy = 1.0f; this.angle = 0.0f; }
public static void DrawString(String pString, float x, float y, ColorName color = ColorName.White) { Azul.Sprite pAzulSprite = new Azul.Sprite(); for (int i = 0; i < pString.Length; i++) { int key = Convert.ToByte(pString[i]); Font pFont = FontManager.Find(FontName.Consolas36pt, key); Debug.Assert(pFont != null); pAzulSprite.Swap(pFont.GetAzulTexture(), pFont.GetAzulRect(), new Azul.Rect(x, y, pFont.GetAzulRect().width, pFont.GetAzulRect().height), ColorFactory.Create(color).pAzulColor); pAzulSprite.Update(); pAzulSprite.Render(); x += pFont.GetAzulRect().width; } }
public Grid(GameObjectName goName, SpriteBaseName sbName, float x, float y, int goIdx) : base(goName, sbName, AlienType.Grid, goIdx) { this.x = x; this.y = y; this.movementXDirection = 20.0f; this.movementYDirection = 0.0f; this.movementXDistance = 20.0f; this.movementYDistance = 5.0f; this.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Yellow).pAzulColor; this.alienCount = 0; this.colCount = 0; this.marchSpeed = 0.75f; this.bombFrequency = 1.0f; this.decayFactor = 0.0125f; this.bombDecayFactor = 0.01f; this.pRandom = new Random(); }
public ShieldCategory Create(ShieldType type, GameObjectName goName, float x = 0.0f, float y = 0.0f, int idx = 0) { ShieldCategory pShield = null; switch (type) { case ShieldType.Brick: pShield = new ShieldBrick(goName, SpriteBaseName.Brick, x, y, idx); break; case ShieldType.LeftTop0: pShield = new ShieldBrick(goName, SpriteBaseName.BrickLeftTop0, x, y, idx); break; case ShieldType.LeftTop1: pShield = new ShieldBrick(goName, SpriteBaseName.BrickLeftTop1, x, y, idx); break; case ShieldType.LeftBottom: pShield = new ShieldBrick(goName, SpriteBaseName.BrickLeftBottom, x, y, idx); break; case ShieldType.RightTop0: pShield = new ShieldBrick(goName, SpriteBaseName.BrickRightTop0, x, y, idx); break; case ShieldType.RightTop1: pShield = new ShieldBrick(goName, SpriteBaseName.BrickRightTop1, x, y, idx); break; case ShieldType.RightBottom: pShield = new ShieldBrick(goName, SpriteBaseName.BrickRightBottom, x, y, idx); break; case ShieldType.Root: pShield = new ShieldRoot(goName, SpriteBaseName.Null, x, y, idx); pShield.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Blue).pAzulColor; Debug.Assert(false); break; case ShieldType.Grid: pShield = new ShieldGrid(goName, SpriteBaseName.Null, x, y, idx); pShield.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Blue).pAzulColor; break; case ShieldType.Column: pShield = new ShieldColumn(goName, SpriteBaseName.Null, x, y, idx); pShield.pCollisionObject.pCollisionSpriteBox.pLineColor = ColorFactory.Create(ColorName.Red).pAzulColor; break; default: Debug.Assert(false); break; } this.pTree.Insert(pShield, this.pParent); pShield.ActivateGameSprite(this.pSpriteBatch); if (GameManager.GetCollisionBoxes()) { pShield.ActivateCollisionSprite(this.pCollisionSpriteBatch); } return(pShield); }