Exemplo n.º 1
0
        public static ITile GeTile(string type)
        {
            switch (type)
            {
            case Stone:
                if (!Tiles.ContainsKey(Stone))
                {
                    Tiles[Stone] = new StoneTile();
                }
                return(Tiles[Stone]);

            case Ceramic:
                if (!Tiles.ContainsKey(Ceramic))
                {
                    Tiles[Ceramic] = new CeramicTile();
                }
                return(Tiles[Ceramic]);

            default:
                throw new ArgumentException();
            }
        }
Exemplo n.º 2
0
        public static ITile GetTile(string tileType)
        {
            switch (tileType)
            {
            case "Ceramic":
                if (!tiles.ContainsKey("Ceramic"))
                {
                    tiles["Ceramic"] = new CeramicTile();
                }
                return(tiles["Ceramic"]);

            case "Stone":
                if (!tiles.ContainsKey("Stone"))
                {
                    tiles["Stone"] = new StoneTile();
                }
                return(tiles["Stone"]);

            default:
                break;
            }
            return(null);
        }