private void Awake() { grids = FindObjectsOfType <MyGrid>(); myProperties = FindObjectOfType <MapDesignerProperties>(); gridUtil = GetComponent <GridUtil>(); sV = FindObjectOfType <SharedVariables>(); }
// Start is called before the first frame update void Awake() { sV = FindObjectOfType <SharedVariables>(); gM = FindObjectOfType <GridManager>(); mapProperties = FindObjectOfType <MapDesignerProperties>(); grids = gM.grids.ToArray(); int ColorCount = mapProperties.colorCount; Color[] mapColors = mapProperties.colors; foreach (MyGrid item in grids) { int randColor = Random.Range(0, ColorCount); item.assignedCell.color = mapColors[randColor]; item.assignedCell.GetComponent <SpriteRenderer>().color = mapColors[randColor]; } }
private MyGrid GetBelowGrid() { if (mapProperties == null) { mapProperties = GetComponent <MapDesignerProperties>(); } int amountOfHorizontalCells = mapProperties.horizontalAmount; if (grids.Count < amountOfHorizontalCells) { return(null); } int belowRowStartingPoint = grids.Count - amountOfHorizontalCells; return(grids[belowRowStartingPoint]); }
public void Awake() { mapProperties = GetComponent <MapDesignerProperties>(); }