コード例 #1
0
 public void Reset()
 {
     this.lives       = 3;
     this.score       = 0;
     this.pGrid       = null;
     this.pShieldZone = null;
 }
コード例 #2
0
ファイル: Missile.cs プロジェクト: xNeophyte/Space_Invaders
        public override void VisitShieldZone(ShieldZone pShieldZone)
        {
            //Debug.WriteLine("in Missile, visit from ShieldZone");
            GameObject pGameObj = (GameObject)pShieldZone.GetFirstChild();

            ColPair.FwdCollide(this, pGameObj);
        }
コード例 #3
0
ファイル: Bomb.cs プロジェクト: xNeophyte/Space_Invaders
        public override void VisitShieldZone(ShieldZone pShieldZone)
        {
            //Debug.WriteLine("in Bomb, visit from ShieldZone");
            GameObject pGameObj = (GameObject)pShieldZone.GetFirstChild();

            // Always set Bomb as ObjB
            ColPair.FwdCollide(this, pGameObj);
        }
コード例 #4
0
        public static ShieldZone CreateShieldZone(float xOrigin, float yOrigin, float xDeltaBetween, int numShields = 4)
        {
            ShieldFactory pZoneSF     = new ShieldFactory(SpriteBatch.Name.Sprites, SpriteBatch.Name.Boxes);
            ShieldZone    pShieldZone = (ShieldZone)pZoneSF.Create(ShieldFactory.Type.Zone, 0, 0);

            for (int i = 0; i < numShields; i++)
            {
                CreateShield(xOrigin + (i * xDeltaBetween), yOrigin, pShieldZone);
            }

            return(pShieldZone);
        }
コード例 #5
0
        public PlayerArtifact(Name name)
        {
            this.name        = name;
            this.lives       = 3;
            this.score       = 0;
            this.level       = 1;
            this.pGrid       = null;
            this.pShieldZone = null;

            this.pTimerMemento             = new TimerMemento();
            this.pGameObjectMemento        = new ManagerMemento();
            this.pColPairMemento           = new ManagerMemento();
            this.pSpritesSBNodeMemento     = new ManagerMemento();
            this.pSpriteBoxesSBNodeMemento = new ManagerMemento();
        }
コード例 #6
0
        public GameObject Create(Type type, float posX, float posY)
        {
            GameObject pGameObj = null;

            switch (type)
            {
            case Type.Brick:
                pGameObj = new ShieldBrick(GameObject.Name.ShieldBrick, Sprite.Name.ShieldBrick, BoxSprite.Name.ShieldBrickBox, posX, posY);
                break;

            case Type.Column:
                pGameObj = new ShieldColumn(GameObject.Name.ShieldColumn, BoxSprite.Name.ShieldColumnBox);
                break;

            case Type.Shield:
                pGameObj = new Shield(GameObject.Name.Shield, BoxSprite.Name.ShieldBox);
                break;

            case Type.Zone:
                pGameObj = new ShieldZone(GameObject.Name.ShieldZone, BoxSprite.Name.ShieldZoneBox);
                break;

            default:
                // something is wrong
                Debug.Assert(false, "GameObject type not supported by this factory");
                break;
            }

            // add it to the gameObjectManager
            Debug.Assert(pGameObj != null);
            GameObjectManager.Attach(pGameObj);

            if (pGOComposite != null)
            {
                // add to grouping
                pGOComposite.Add(pGameObj);
            }

            // Attached to Batches
            this.pBoxSpriteBatch.Attach(pGameObj.poColObj.pColSprite);
            this.pSpriteBatch.Attach(pGameObj.pProxySprite);
            return(pGameObj);
        }
コード例 #7
0
 public virtual void VisitShieldZone(ShieldZone pShieldZone)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by ShieldZone not implemented");
     Debug.Assert(false);
 }