Example #1
0
        public void Init()
        {
            ElementPrefab.SetActive(false);
            bool first = true;

            foreach (var color in GameController.Instance.BallColors)
            {
                GameObject go = Instantiate(ElementPrefab, transform);
                go.transform.localScale = Vector3.one;
                go.SetActive(true);
                ColorCell cell = go.GetComponent <ColorCell>();
                if (first)
                {
                    cell.OutlineImage.enabled = true;
                    first = false;
                }
                else
                {
                    cell.OutlineImage.enabled = false;
                }
                cell.ColorImage.color = color;
            }
        }
Example #2
0
 // using by button
 public void ColorCellClicked(ColorCell cell)
 {
     OnBallColorChangedEvent?.Invoke(cell.ColorImage.color);
 }