// Use this for initialization void Start() { level = GameObject.FindObjectOfType <BulletGridGenerator>(); for (int i = 0; i < CellFeatures.Length; i++) { CellFeatures[i] = Instantiate <CellFeature>(CellFeatures[i]); CellFeatures[i].Cell = this; CellFeatures[i].transform.parent = transform; } FindObjectOfType <PlaceabilityOutlineHandler>().AddCell(this); gameObject.AddComponent <AudioSource>(); }
public void AddCell(Cell toAdd) { if (grid == null) { grid = toAdd.getGameCell().Grid; xOffset = grid.gridPositionToWorldPosition(new GridPosition(0, 0)) - grid.gridPositionToWorldPosition(new GridPosition(1, 0)); yOffset = grid.gridPositionToWorldPosition(new GridPosition(0, 0)) - grid.gridPositionToWorldPosition(new GridPosition(0, 1)); int gridWidth = toAdd.getGameCell().Grid.GameGrid.Length; int gridHeight = toAdd.getGameCell().Grid.GameGrid[0].Length; corners = new GameObject[gridWidth + 1][]; verticalEdges = new GameObject[gridWidth + 1][]; horizontalEdges = new GameObject[gridWidth + 1][]; for (int x = 0; x < corners.Length; x++) { corners[x] = new GameObject[gridHeight + 1]; verticalEdges[x] = new GameObject[gridHeight + 1]; horizontalEdges[x] = new GameObject[gridHeight + 1]; for (int y = 0; y < corners[x].Length; y++) { verticalEdges[x][y] = new GameObject(); verticalEdges[x][y].AddComponent <SpriteRenderer>(); verticalEdges[x][y].transform.position = placeVerticalEdge(x, y); verticalEdges[x][y].transform.localScale = (toAdd.transform.localScale / BulletGridGenerator.CELL_SCALE) / 2; verticalEdges[x][y].GetComponent <SpriteRenderer>().sortingOrder = 2; horizontalEdges[x][y] = new GameObject(); horizontalEdges[x][y].AddComponent <SpriteRenderer>(); horizontalEdges[x][y].transform.position = placeHorizontalEdge(x, y); horizontalEdges[x][y].transform.localScale = (toAdd.transform.localScale / BulletGridGenerator.CELL_SCALE) / 2; horizontalEdges[x][y].GetComponent <SpriteRenderer>().sortingOrder = 2; corners[x][y] = new GameObject(); corners[x][y].AddComponent <SpriteRenderer>(); corners[x][y].transform.position = placeCorner(x, y); corners[x][y].transform.localScale = (toAdd.transform.localScale / BulletGridGenerator.CELL_SCALE) / 2; corners[x][y].GetComponent <SpriteRenderer>().sortingOrder = 2; } } } OnVisibilityChanged(toAdd.getGameCell(), toAdd.getGameCell().isExplored); toAdd.getGameCell().NotifyVisibilityChanged += OnVisibilityChanged; }
// Use this for initialization void Start() { currentLevel = FindObjectOfType <BulletGridGenerator>(); GameObject.FindObjectOfType <TimestepManager>().addListener(this); schematic = GameObject.Instantiate(schematic); }
// Use this for initialization void Start() { _grid = FindObjectOfType <BulletGridGenerator>(); NotifyResourceConsumed += ResourceConsumedHandler; gameObject.AddComponent <AudioSource>(); }
void Start() { level = GameObject.FindObjectOfType <BulletGridGenerator>(); gameObject.AddComponent <AudioSource>(); }
// Use this for initialization void Start() { _grid = FindObjectOfType <BulletGridGenerator>(); text = FindObjectOfType <TutorialTextManager>(); NotifyResourceConsumed += ResourceConsumedHandler; }