void OnGUI() { if (!MapGenerator.getInstance().IsMapLoaded) { return; } float Size = SmallSize; if (UseLarge) { Size = LargeSize; } _frameRect = new Rect(0, 0, Screen.height * Size / 100.0f, Screen.height * Size / 100.0f); _cellSize = Mathf.Min(_frameRect.xMax / Columns, _frameRect.yMax / Rows); if (_quads == null) { _quads = new Dictionary <Vector2, Texture2D>(); for (var j = 0; j < Rows; j++) { for (var i = 0; i < Columns; i++) { _quads.Add(new Vector2(i, j), new Texture2D(1, 1)); } } } if (_backgroundQuad == null) { _backgroundQuad = new Texture2D(1, 1); _backgroundQuad.SetPixel(0, 0, new Color(0, 0, 0, 0.4f)); _backgroundQuad.Apply(); } DrawQuad(_frameRect, _backgroundQuad); if (_border == null) { _border = new Texture2D(1, 1); _border.SetPixel(0, 0, new Color(0.8f, 0.46f, 0.0f)); _border.Apply(); } DrawQuad(new Rect(0, _frameRect.xMax, _frameRect.xMax + 6, 4), _border); DrawQuad(new Rect(_frameRect.xMax, 0, 4, _frameRect.xMax), _border); if (_playerQuad == null) { _playerQuad = new Texture2D(1, 1); _playerQuad.SetPixel(0, 0, Color.red); _playerQuad.Apply(); } foreach (var cell in Cells) { if (!visited.Contains(cell)) { continue; } var quad = _quads[cell]; quad.SetPixel(0, 0, GetCellColor(cell)); quad.Apply(); DrawCell(cell, quad); } DrawCell(PlayerLocation, _playerQuad); }