Exemplo n.º 1
0
        public TileSet(string name, string id, string palette, TerrainTypeInfo[] terrainInfo)
        {
            Name = name;
            Id = id;
            Palette = palette;
            TerrainInfo = terrainInfo;

            if (TerrainInfo.Length >= byte.MaxValue)
                throw new InvalidDataException("Too many terrain types.");

            for (byte i = 0; i < terrainInfo.Length; i++)
            {
                var tt = terrainInfo[i].Type;
                if (terrainIndexByType.ContainsKey(tt))
                    throw new InvalidDataException("Duplicate terrain type '{0}'.".F(tt));

                terrainIndexByType.Add(tt, i);
            }

            defaultWalkableTerrainIndex = GetTerrainIndex("Clear");
        }
Exemplo n.º 2
0
		public TileSet(string name, string id, string palette, string[] extensions, TerrainTypeInfo[] terrainInfo)
		{
			this.Name = name;
			this.Id = id;
			this.Palette = palette;
			this.Extensions = extensions;
			this.terrainInfo = terrainInfo;

			for (var i = 0; i < terrainInfo.Length; i++)
			{
				var tt = terrainInfo[i].Type;

				if (terrainIndexByType.ContainsKey(tt))
					throw new InvalidDataException("Duplicate terrain type '{0}'.".F(tt));

				terrainIndexByType.Add(tt, i);
			}
			defaultWalkableTerrainIndex = GetTerrainIndex("Clear");
		}