LimitantesDeMapa VerificaMudancasDeLimitantes(MyVector2Int V, LimitantesDeMapa L) { if (L.xMin > V.x) { L.xMin = V.x; } if (L.yMin > V.y) { L.yMin = V.y; } if (L.xMax < V.x) { L.xMax = V.x; } if (L.yMax < V.y) { L.yMax = V.y; } return(L); }
private Color CorAlvoMap(int row, int col, LimitantesDeMapa L) { MyVector2Int V = new MyVector2Int(col + L.xMin, row + L.yMin); if (GetMapDates.ContainsKey(V)) { return(GetMapDates[V].cor); } return(Color.white); }
private LimitantesDeMapa CalculaLimitanteMap() { LimitantesDeMapa L = CalculaLimitanteMapBase(); Dictionary <MyVector2Int, MyColor> .KeyCollection keys = GetMapDates.Keys; foreach (MyVector2Int V in keys) { L = VerificaMudancasDeLimitantes(V, L); } return(L); }
private LimitantesDeMapa CalculaLimitanteMapBase() { LimitantesDeMapa L = new LimitantesDeMapa() { xMin = 0, xMax = 0, yMin = 0, yMax = 0 }; Dictionary <MyVector2Int, MyColor> .KeyCollection.Enumerator z = GetMapDates.Keys.GetEnumerator(); z.MoveNext(); MyVector2Int V = z.Current; L = new LimitantesDeMapa() { xMin = V.x, xMax = V.x, yMin = V.y, yMax = V.y }; return(L); }
public Texture2D TexturaDeMapaAtual() { LimitantesDeMapa L = CalculaLimitanteMap(); Texture2D tex = new Texture2D(L.xMax - L.xMin, L.yMax - L.yMin); for (int row = 0; row < L.yMax - L.yMin; row++) { for (int col = 0; col < L.xMax - L.xMin; col++) { tex.SetPixel(col, row, CorAlvoMap(row, col, L)); } } tex.Apply(); return(tex); }