Ejemplo n.º 1
0
        public GameObject Create(GameObject.Name name, AlienCategory.Type type, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pGameObj = null;

            switch (type)
            {
            case AlienCategory.Type.Green:
                pGameObj = new GreenAlien(GameObject.Name.GreenAlien, GameSprite.Name.GreenAlien, posX, posY);
                break;

            case AlienCategory.Type.Red:
                pGameObj = new RedAlien(GameObject.Name.RedAlien, GameSprite.Name.RedAlien, posX, posY);
                break;

            case AlienCategory.Type.White:
                pGameObj = new WhiteAlien(GameObject.Name.WhiteAlien, GameSprite.Name.WhiteAlien, posX, posY);
                break;

            case AlienCategory.Type.Yellow:
                pGameObj = new YellowAlien(GameObject.Name.YellowAlien, GameSprite.Name.YellowAlien, posX, posY);
                break;

            case AlienCategory.Type.Blue:
                pGameObj = new BlueAlien(GameObject.Name.BlueAlien, GameSprite.Name.BlueAlien, posX, posY);
                break;

            case AlienCategory.Type.Grid:
                pGameObj = new AlienGrid(name, GameSprite.Name.NullObject, posX, posY);
                break;

            case AlienCategory.Type.Column:
                pGameObj = new AlienColumn(name, GameSprite.Name.NullObject, posX, posY);
                break;

            default:
                // something is wrong
                Debug.Assert(false);
                break;
            }
            Debug.Assert(pGameObj != null);

            pGameObj.ActivateGameSprite(this.pSpriteBatch);
            pGameObj.ActivateCollisionSprite(this.pBoxSpriteBatch);
            GameObjectMan.Attach(pGameObj);

            return(pGameObj);
        }
Ejemplo n.º 2
0
 public virtual void VisitYellowAlien(YellowAlien b)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by YellowAlien not implemented");
     Debug.Assert(false);
 }