示例#1
0
    public static MapTile CreateTile(Transform _parent, int _x, int _y, int _seed)
    {
        MapTileType type    = _seed < 80 ? MapTileType.Grass : MapTileType.Water;
        GameObject  tileObj = Instantiate <GameObject>(GetPrefab(type), _parent);

        tileObj.name = "_tile_" + _x + "_" + _y + "_" + type.ToString();
        tileObj.transform.position = new Vector3(_x - m_mapXMiddle, 0, _y - m_mapYMiddle);
        MapTile newTile = tileObj.AddComponent <MapTile>();

        newTile.TileType = type;
        newTile.Position = new Position(_x, _y);
        newTile.Walkable = type == MapTileType.Grass;
        return(newTile);
    }
示例#2
0
 public override string ToString()
 {
     return(tile.ToString());
 }