public static int ToTileNumber(this TileEnum value) { if (value.ToString().Length == 4) { return(int.Parse(value.ToString().Substring(1, 2))); } return(int.Parse(value.ToString().Substring(1, 1))); }
public static char ToTileChar(this TileEnum value) { if (value.ToString().Length == 4) { return(value.ToString()[3]); } return(value.ToString()[2]); }
void createTile(IntVector2 tilePos, TileEnum type) { GameObject sample = Instantiate(tilledCell); if (type == TileEnum.TILLED) { sample.GetComponentInChildren <Renderer>().material = tilledMaterial; } else { sample.GetComponentInChildren <Renderer>().material = wateredMaterial; } //sample.transform.parent = transform; sample.name = type.ToString(); sample.transform.position = new Vector3(tilePos.x * cellSize + cellSize / 2, 0, tilePos.y * cellSize + cellSize / 2); objectTileGrid[tilePos] = sample; if (!Game.current.tileGrid.ContainsKey(tilePos)) { Game.current.tileGrid[tilePos] = type; } }