public void PickColorForCurrentColorButton(GameObject colorWidget) { gameObject.SetActive(false); colorButtons[currentColor].addColorLabel.gameObject.SetActive(false); colorButtons[currentColor].selectColorButton.gameObject.SetActive(true); ColorWidget newColorWidget = Instantiate(colorWidget.gameObject).GetComponent <ColorWidget>(); colorButtons[currentColor].SetColorWidget(newColorWidget); // Pass color information to shader switch (currentColor) { case 0: DecoratorPanel.Instance.photoRenderer.material.SetColor("_Color1", newColorWidget.GetComponent <Graphic>().color); break; case 1: DecoratorPanel.Instance.photoRenderer.material.SetColor("_Color2", newColorWidget.GetComponent <Graphic>().color); break; case 2: DecoratorPanel.Instance.photoRenderer.material.SetColor("_Color3", newColorWidget.GetComponent <Graphic>().color); break; } }
public void PickCombination(GameObject combinationWidget) { gameObject.SetActive(false); colorButtons[currentColor].addColorLabel.gameObject.SetActive(false); colorButtons[currentColor].selectColorButton.gameObject.SetActive(true); int prevCurrentColor = currentColor; for (currentColor = 0; currentColor < colorButtons.Count; currentColor++) { ColorWidget newColorWidget = Instantiate(colorWidgetPrefab).GetComponent <ColorWidget>(); newColorWidget.colorName = combinationWidget.GetComponent <CombinationWidget>().colorNames[currentColor]; newColorWidget.GetComponent <Graphic>().color = combinationWidget.GetComponent <CombinationWidget>().graphics[currentColor].color; PickColorForCurrentColorButton(newColorWidget.gameObject); Destroy(newColorWidget.gameObject); } currentColor = prevCurrentColor; }