private IEnumerator AddBorder() { yield return(GameMgmt.Get().load.ShowSubMessage($"Add border")); TileMapConfig16 t = CreateLayer16("Border", SortBorder).GetComponent <TileMapConfig16>(); t.transform.position = new Vector3(0, 0, -1); for (int x = -1; x <= GameMgmt.Get().data.map.width; x++) { t.SetTile(x, -1, border); t.SetTile(x, GameMgmt.Get().data.map.height, border); } yield return(GameMgmt.Get().load.ShowSubMessage($"Add vertical border")); for (int y = 0; y < GameMgmt.Get().data.map.height; y++) { t.SetTile(-1, y, border); t.SetTile(GameMgmt.Get().data.map.width, y, border); } }
protected override void SetTile(TileMapConfig16 tile, NVector pos) { this._pos = pos; //how has it? Player player = S.Players().OverlayHighest(ID(), pos); if (player == null) { return; } tile.SetTile(this, new Vector3Int(pos.x, pos.y, 0), _frontier, false, player.Coat().color); }
private IEnumerator AddBorder() { yield return(GameMgmt.Get().load.ShowSubMessage($"Add border")); TileBase bTile = GameMgmt.Get().newMap.prototypeBorder; border = CreateNewLayer("Border", dataLevel.LayerCount() + 5); border.transform.position = new Vector3(0, 0, -1); for (int x = -1; x <= GameMgmt.Get().data.map.width; x++) { border.SetTile(x, -1, bTile); border.SetTile(x, GameMgmt.Get().data.map.height, bTile); } yield return(GameMgmt.Get().load.ShowSubMessage($"Add vertical border")); for (int y = 0; y < GameMgmt.Get().data.map.height; y++) { border.SetTile(-1, y, bTile); border.SetTile(GameMgmt.Get().data.map.width, y, bTile); } }
public IEnumerator AddLayer(int layer) { TileMapConfig16 t = CreateNewLayer($"{layer} {layers.Count}", layer); TileMapConfig16 w = CreateNewLayer($"W{layer} {layers.Count}", layer).GetComponent <TileMapConfig16>(); string max = "/" + mapData.width + "/" + layers.Count; for (int x = 0; x < mapData.width; x++) { for (int y = 0; y < mapData.height; y++) { Vector3Int v = new Vector3Int(x, y, layer); int d = dataLevel.At(v); //skip? if (d == -1) { continue; } try { t.SetTile(dataLevel, v, L.b.terrains[d], false, Color.white); int q = dataLevel.At(v, true); w.SetTile(dataLevel, v, L.b.terrains[q], true, Color.white); } catch (Exception e) { Debug.Log(d + " " + L.b.terrains.Values().Count(terr => terr.defaultTile == d)); Debug.Log($"{x}/{dataLevel.Width()}/{mapData.width},{y}/{dataLevel.Height()}/{mapData.height}"); Debug.LogException(new InvalidDataException($"Field type {d} does not exist", e)); break; } } yield return(GameMgmt.Get().load.ShowSubMessage($"Loading {layer} {x}{max}")); } layers.Add(t); layersWinter.Add(w); w.gameObject.SetActive(false); }