private void createBomb(PlayerID _id, Ship s) { BombData data = BombManager.Instance().getNextBomb(_id); bombID = data.ID; bombsprite = data.sprite; spriteRef = new Sprite_Proxy(bombsprite, (int)s.spriteRef.pos.X, (int)s.spriteRef.pos.Y, 0.5f, Color.White); SBNode bombBatch = SpriteBatchManager.Instance().getBatch(batchEnum.bomb); bombBatch.addDisplayObject(spriteRef); orgPos = spriteRef.pos; if (_id == PlayerID.one) { image1 = ImageManager.Instance().getImage(ImageEnum.bluebomb1); image2 = ImageManager.Instance().getImage(ImageEnum.bluebomb2); } else { image1 = ImageManager.Instance().getImage(ImageEnum.greenbomb1); image2 = ImageManager.Instance().getImage(ImageEnum.greenbomb2); } spriteRef.sprite.image = image1; curImage = 0; state = BombState.alive; }
public BombData getNextBomb(PlayerID _id) { BombData outData = new BombData(); if (_id == PlayerID.one) outData = getP1BombSprite(); else outData = getP2BombSprite(); return outData; }
private BombData getP2BombSprite() { BombData outData = new BombData(); for (int i = 0; i < 5; i++) { if (p2BombTable[i] != null) { outData.sprite = p2BombTable[i]; outData.ID = i; p2BombTable[i] = null; p2Ptr++; break; } } return outData; }