예제 #1
0
        public static Entity BuildItemEntity(ItemType type, Vector2 loc, EventSoundEffects sounds)
        {
            Entity toReturn = null;

            switch (type)
            {
            case ItemType.Flower:
                toReturn = new FlowerEntity(loc, sounds);
                break;

            case ItemType.Coin:
                toReturn = new CoinEntity(loc, sounds);
                break;

            case ItemType.RedMushroom:
                toReturn = new RedMushroomEntity(loc, sounds);
                break;

            case ItemType.GreenMushroom:
                toReturn = new GreenMushroomEntity(loc, sounds);
                break;

            case ItemType.Star:
                toReturn = new StarEntity(loc, sounds);
                break;

            case ItemType.Axe:
                toReturn = new AxeEntity(loc, sounds);
                break;
            }
            return(toReturn);
        }
예제 #2
0
        public static Entity LoadItem(String id, float xVal, float yVal, ContentManager Content)
        {
            Entity entity = null;

            if (id.Equals("Coin"))
            {
                entity = new CoinEntity(new ItemFactory(Content), new Vector2(xVal, yVal));
            }
            else if (id.Equals("Flower"))
            {
                entity = new FlowerEntity(new ItemFactory(Content), new Vector2(xVal, yVal));
            }
            else if (id.Equals("Mushroom"))
            {
                entity = new MushroomEntity(new ItemFactory(Content), new Vector2(xVal, yVal));
            }
            else if (id.Equals("OneUp"))
            {
                entity = new OneUpMushroomEntity(new ItemFactory(Content), new Vector2(xVal, yVal));
            }
            else if (id.Equals("Star"))
            {
                entity = new StarEntity(new ItemFactory(Content), new Vector2(xVal, yVal));
            }
            return(entity);
        }