private void CreateOptionsDisplay(TileVisualBehavior visualBehavior, MainGrid mainGrid) { TileDebugger display = visualBehavior.gameObject.AddComponent <TileDebugger>(); display.Grid = mainGrid; display.Model = visualBehavior.Model; }
private TileVisualBehavior CreateDisplayTile(int x, int y) { GameObject obj = Instantiate(DisplayTilePrefab); obj.name = x + " " + y; obj.transform.position = new Vector3(x + .5f, y + .5f, 0); TileVisualBehavior behavior = obj.AddComponent <TileVisualBehavior>(); behavior.Model = MainGrid.Cells[x, y]; return(behavior); }
private IEnumerable <TileVisualBehavior> CreateDisplayTiles() { List <TileVisualBehavior> ret = new List <TileVisualBehavior>(); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { TileVisualBehavior behavior = CreateDisplayTile(x, y); behavior.transform.SetParent(DisplayTilesTransform, false); ret.Add(behavior); } } DisplayTilesTransform.position = new Vector3(-(float)Width / 2, -(float)Height / 2); return(ret); }