private FallStrategy chooseFallStrategy(GameSprite.Name spriteName) { FallStrategy pFallStrategy = null; switch (spriteName) { case GameSprite.Name.BombDagger: pFallStrategy = new FallDagger(); break; case GameSprite.Name.BombStraight: pFallStrategy = new FallStraight(); break; case GameSprite.Name.BombZigZag: pFallStrategy = new FallZigZag(); break; default: Debug.Assert(false); break; } return(pFallStrategy); }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public ExplosionSpriteObserver(GameSprite.Name spriteName, float delay = 0.2f) { this.pTargetObj = null; this.pExplosionSprite = null; this.name = spriteName; this.timeDelay = delay; }
public Missile(GameObject.Name name, GameSprite.Name spriteName, float posX, float posY) : base(name, spriteName) { this.x = posX; this.y = posY; this.delta = 15.0f; }
//--------------------------------------------------------------------------------------------------------- // Constructor //--------------------------------------------------------------------------------------------------------- public Composite(GameObject.Name gameName, GameSprite.Name spriteName) : base(gameName, spriteName) { this.poHead = null; this.poLast = null; this.holder = Container.Composite; }
public PlayerExplosion(GameObject.Name gameObjectname, GameSprite.Name gameSpriteName, float posX, float posY) : base(gameObjectname, gameSpriteName) { this.x = posX; this.y = posY; this.pProxySprite.pSprite.SwapColor(1.0f, 1.0f, 1.0f); }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- //public Composite() //{ // this.poHead = null; // this.holder = Container.COMPOSITE; //} public Composite(GameObject.Name gameObjName, GameSprite.Name gameSpriteName) : base(gameObjName, gameSpriteName) { this.poHead = null; this.poTail = null; this.holder = Container.COMPOSITE; }
public RedAlien(GameObject.Name name, GameSprite.Name spriteName, float posX, float posY) : base(name, spriteName) { this.x = posX; this.y = posY; this.nPoints = 10; }
public AnimationSprite(GameSprite.Name spriteName) { this.pSprite = GameSpriteMan.Find(spriteName); Debug.Assert(this.pSprite != null); this.pCurrImage = null; this.poHeadImage = null; }
public static GameSprite Create(GameObject.Category cate, GameSprite.Name name, float x, float y, Image.Name imgName) { Image img = ImageManager.getInstance().FindImageByName(imgName); Debug.Assert(img != null); float w; float h; // For missile and bomb, we don't need a square if (cate == GameObject.Category.Missile) { w = 2.5f; h = 10.0f; } else if (cate == GameObject.Category.Bomb) { w = 5f; h = 20f; } else if (cate == GameObject.Category.Wall) { w = 896f; h = 1f; } else { w = 50f; h = 50f; } return(pGameSpriteManager.AddGameSprite(cate, name, 0f, 1.0f, 1.0f, x, y, img, 400f, 500f, w, h)); }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public Missile(GameObject.Name gameObjName, GameSprite.Name spriteName, float px, float py, float delta = 12.0f) : base(gameObjName, spriteName, MissileCategory.Type.Missile) { this.x = px; this.y = py; this.delta = delta; }
public Bomb ActivateBomb(Random rnd) { //Random rnd = new Random(); int number = rnd.Next(0, 3); GameSprite.Name name = GameSprite.Name.BombStraight + number; Bomb pBomb = null; switch (name) { case GameSprite.Name.BombStraight: pBomb = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombStraight, new FallStraight(), this.x, this.y - (float)0.5 * this.poColObj.poColRect.height); break; case GameSprite.Name.BombDagger: pBomb = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombDagger, new FallDagger(), this.x, this.y - (float)0.5 * this.poColObj.poColRect.height); break; case GameSprite.Name.BombZigZag: pBomb = new Bomb(GameObject.Name.Bomb, GameSprite.Name.BombZigZag, new FallZigZag(), this.x, this.y - (float)0.5 * this.poColObj.poColRect.height); break; default: // something is wrong Debug.Assert(false); break; } this.bomb = pBomb; return(pBomb); }
public LeftUFO(GameObject.Name name, GameSprite.Name spriteName, float posX, float posY) : base(name, spriteName) { this.x = posX; this.y = posY; this.delta = -2.0f; }
//-------------------------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------------------------- public Composite(GameObject.Name gameObjectName, GameSprite.Name gameSpriteName) : base(gameObjectName, gameSpriteName) { this.poHead = null; this.poLast = null; this.type = Component.Container.COMPOSITE; }
public Missile(GameSprite.Name spriteName, GameObject.Name name, float posX, float posY) : base(spriteName, name) { this.x = posX; this.y = posY; this.orgY = posY; this.bHit = false; }
public Missile(GameObject.Name gameObjectname, GameSprite.Name gameSpriteName, float posX, float posY) : base(gameObjectname, gameSpriteName) { this.x = posX; this.y = posY; this.isFlying = false; }
public UFO(GameObject.Name gOName, GameSprite.Name gSeName, float x, float y, SndObserver pSndObs) : base(gOName, gSeName, UFOCategory.Type.UFO) { this.SetXY(x, y); this.pSnd = pSndObs; this.state = new UFOStateEnd(); }
//--------------------------------------------------------------------------------------------------------- // Methods //--------------------------------------------------------------------------------------------------------- public void Set(GameSprite.Name name, Image pImage, float x, float y, float width, float height, Azul.Color pColor) { Debug.Assert(pImage != null); Debug.Assert(this.poScreenRect != null); Debug.Assert(this.poAzulSprite != null); this.poScreenRect.Set(x, y, width, height); this.pImage = pImage; this.name = name; if (pColor == null) { Debug.Assert(GameSprite.psTmpColor != null); GameSprite.psTmpColor.Set(1, 1, 1); this.poAzulColor.Set(psTmpColor); } else { this.poAzulColor.Set(pColor); } this.poAzulSprite.Swap(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, this.poAzulColor); this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
protected AlienCategory(GameObject.Name gameObjectName, GameSprite.Name gameSpriteName, int _Index, float _ori_X, float _ori_Y) : base(gameObjectName, gameSpriteName) { this.index = _Index; this.originX = _ori_X; this.originY = _ori_Y; }
//---------------------------------------------------------------------------------- // Data //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public WallGroup(GameObject.Name gameName, GameSprite.Name spriteName, float px, float py) : base(gameName, spriteName) { this.x = px; this.y = py; this.poCollObj.pCollSprite.SetLineColor(1.0f, 1.0f, 1.0f); }
public ShieldBrick(GameObject.Name gameObjectname, GameSprite.Name gameSpriteName, int _Index, float posX, float posY) : base(gameObjectname, gameSpriteName) { this.x = posX; this.y = posY; this.index = _Index; }
public BombGroup(GameObject.Name gameObjectname, GameSprite.Name gameSpriteName, float posX, float posY) : base(gameObjectname, gameSpriteName) { this.x = posX; this.y = posY; this.pColObject.pBoxSprite.SetColor(0.0f, 1.0f, 0.0f); }
public Player(GameObject.Name gameObjectname, GameSprite.Name gameSpriteName, float posX, float posY) : base(gameObjectname, gameSpriteName) { this.x = posX; this.y = posY; this.pProxySprite.pSprite.SwapColor(0.7f, 0.0f, 0.3f); }
public GreenBird(GameSprite.Name spriteName, GameObject.Name name, float posX, float posY) : base(spriteName, name) { this.x = posX; this.y = posY; this.speed = 1.0f; }
public SpriteNode Attach(GameSprite.Name name) { SpriteNode spriteNode = (SpriteNode)baseAdd(); spriteNode.Initialize(name); return(spriteNode); }
public void Set(GameSprite.Name myName, Image pImage, float mx, float my, float w, float h, Azul.Color pColor) { Debug.Assert(pImage != null); Debug.Assert(this.poAzulColor != null); Debug.Assert(this.poAzulSprite != null); this.name = myName; this.pImage = pImage; this.poScreenRect.Set(mx, my, w, h); if (pColor == null) { Debug.Assert(psTempColor != null); GameSprite.psTempColor.Set(1, 1, 1); this.poAzulColor.Set(psTempColor); } else { this.poAzulColor.Set(pColor); } Debug.Assert(this.poAzulSprite != null); this.poAzulSprite.Swap(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, this.poAzulColor); //grab data from the Azul Sprite, then update/sync this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
public ExplosionGroup(GameObject.Name gameObjectname, GameSprite.Name gameSpriteName, float posX, float posY) : base(gameObjectname, gameSpriteName) { this.x = posX; this.y = posY; this.pColObject.pBoxSprite.SetColor(0, 1, 0); }
public ExplosionSpriteObserver(ExplosionSpriteObserver pObserver) { this.pTargetObj = pObserver.pTargetObj; this.pExplosionSprite = pObserver.pExplosionSprite; this.name = pObserver.name; this.timeDelay = pObserver.timeDelay; }
//---------------------------------------------------------------------------------- // Data //---------------------------------------------------------------------------------- //---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public ShieldGrid(GameObject.Name name, GameSprite.Name spriteName, float posX, float posY) : base(name, spriteName) { this.x = posX; this.y = posY; this.poCollObj.pCollSprite.SetLineColor(1.0f, 0.0f, 1.0f); }
override public void Execute(float deltaTime) { int pFreq = pRandom.Next(1, 10) / this.nCurrLevel; AlienGrid pGrid = (AlienGrid)GameObjectMan.Find(GameObject.Name.AlienGrid); AlienCategory pAlien = pGrid.GetRandomAlien(); // HACK don't crash pleease if (pAlien == null) { TimerMan.Add(TimeEvent.Name.BombSpawn, this, pFreq); return; } int type = pRandom.Next(0, 2); FallStrategy pFallStrategy = null; switch (type) { case (0): pFallStrategy = new FallZigZag(); break; case (1): pFallStrategy = new FallDagger(); break; case (2): pFallStrategy = new FallStraight(); break; } type = pRandom.Next(0, 2); GameSprite.Name pGameSpriteName = GameSprite.Name.Uninitialized; switch (type) { case (0): pGameSpriteName = GameSprite.Name.BombZigZag; break; case (1): pGameSpriteName = GameSprite.Name.BombDagger; break; case (2): pGameSpriteName = GameSprite.Name.BombStraight; break; } Bomb pBomb = new Bomb(GameObject.Name.Bomb, pGameSpriteName, pFallStrategy, pAlien.x, pAlien.y); pBomb.ActivateCollisionSprite(this.pSB_Boxes); pBomb.ActivateGameSprite(this.pSB_Bombs); GameObject pBombRoot = GameObjectMan.Find(GameObject.Name.BombRoot); Debug.Assert(pBombRoot != null); pBombRoot.Add(pBomb); TimerMan.Add(TimeEvent.Name.BombSpawn, this, pFreq); }
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); }