Example #1
0
        public static IndoorTile Create(UInt32 tileID, IndoorTileMap map)
        {
            GameObject go     = new GameObject(tileID.ToString());
            IndoorTile result = go.AddComponent <IndoorTile>();

            result._map    = map;
            result._tileID = tileID;

            result.InstantiateModel();
            return(result);
        }
        private void InstantiateTiles(IndoorTileMapData mapData)
        {
            IndoorTile newTile;
            UInt16     x, y;

            for (UInt32 i = 0; i < mapData.tiles.Length; i++)
            {
                newTile = IndoorTile.Create(mapData.tiles[i].tileID, this);
                newTile.transform.parent = transform;
                GetTileIndexes(mapData.tiles[i].tileID, out x, out y);

                newTile.transform.localPosition = new Vector3(x + 0.5f, 0, y + 0.5f) * TILE_SIZE;

                _tiles[mapData.tiles[i].tileID] = newTile;
            }
        }