public void CountUpAroundTiles(ITileContents target) { var type = target.GetType(); foreach (var tile in _aroundTiles) { if (!tile.ContentsMap.ContainsKey(type)) { tile.ContentsMap.Add(type, 0); } tile.ContentsMap[type]++; } }
public void SetContents(ITileContents contents, int index = 1) { for (int i = 0; i < index; i++) { var x = UnityEngine.Random.Range(0, Width); var y = UnityEngine.Random.Range(0, Height); var tile = Map[y, x].GetComponent <Tile>(); if (tile.Contents.GetType() != typeof(None)) { i--; continue; } tile.Contents = contents; tile.CountUpAroundTiles(contents); } }
public void ShowContents(ITileContents contents) { _contents.GetComponent <Image>().sprite = contents.Image; }