示例#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.Squid:
                pGameObj = new SquidAlien(name, GameSprite.Name.SquidOpen, posX, posY);
                break;

            case AlienCategory.Type.Crab:
                pGameObj = new CrabAlien(name, GameSprite.Name.CrabOpen, posX, posY);
                break;

            case AlienCategory.Type.Octopus:
                pGameObj = new OctopusAlien(name, GameSprite.Name.OctopusOpen, posX, posY);
                break;

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

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

            default:
                // something is wrong
                Debug.Assert(false);
                break;
            }

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

            // Attached to Group
            pGameObj.ActivateGameSprite(this.pSpriteBatch);
            pGameObj.ActivateCollisionSprite(this.pCollisionSpriteBatch);

            return(pGameObj);
        }
 public virtual void VisitOctopusAlien(OctopusAlien o)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by OctopusAlien not implemented");
     Debug.Assert(false);
 }