Пример #1
0
        private void Awake()
        {
            grids        = FindObjectsOfType <MyGrid>();
            myProperties = FindObjectOfType <MapDesignerProperties>();
            gridUtil     = GetComponent <GridUtil>();

            sV = FindObjectOfType <SharedVariables>();
        }
Пример #2
0
        // 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];
            }
        }