Exemple #1
0
        public GameObject Create(GameObject.Name name, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pGameObj = null;

            switch (name)
            {
            case GameObject.Name.PurpleOctopus:
                pGameObj = new PurpleOctopus(GameObject.Name.PurpleOctopus, GameSprite.Name.PurpleOctopus, posX, posY);
                break;

            case GameObject.Name.BlueCrab:
                pGameObj = new BlueCrab(GameObject.Name.BlueCrab, GameSprite.Name.BlueCrab, posX, posY);
                break;

            case GameObject.Name.GreenSquid:
                pGameObj = new GreenSquid(GameObject.Name.GreenSquid, GameSprite.Name.GreenSquid, posX, posY);
                break;

            case GameObject.Name.OrangeSaucer:
                pGameObj = new OrangeSaucer(GameObject.Name.OrangeSaucer, GameSprite.Name.OrangeSaucer, posX, posY);
                break;

            case GameObject.Name.AlienColumn:
                pGameObj = new AlienColumn(GameObject.Name.AlienColumn, GameSprite.Name.NullObject, 0.0f, 0.0f);
                break;

            case GameObject.Name.AlienGrid:
                pGameObj = new AlienGrid(GameObject.Name.AlienGrid, GameSprite.Name.NullObject, 0.0f, 0.0f);
                break;

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

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

            return(pGameObj);
        }
Exemple #2
0
        public GameObject Create(AlienCategory.Type type, GameObject.Name gameName, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pAlien = null;

            switch (type)
            {
            case AlienCategory.Type.Squid:
                pAlien = new Squid(gameName, GameSprite.Name.Squid, posX, posY);
                break;

            case AlienCategory.Type.Crab:
                pAlien = new Crab(gameName, GameSprite.Name.Crab, posX, posY);
                break;

            case AlienCategory.Type.Octopus:
                pAlien = new Octopus(gameName, GameSprite.Name.Octopus, posX, posY);
                break;

            case AlienCategory.Type.AlienColumn:
                pAlien = new AlienColumn(gameName, GameSprite.Name.NullObject, posX, posY);
                break;

            case AlienCategory.Type.AlienGrid:
                pAlien = new AlienGrid(gameName, GameSprite.Name.NullObject, posX, posY);
                break;

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

            // add to the tree
            this.pTree.Add(pAlien);

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

            return(pAlien);
        }