public void pickElement(GameObject obj) { Renderer renderer = obj.GetComponent <Renderer>(); if (getElement.getElement() == 0) { //Fire renderer.material = materials[getElement.getElement()]; Light light = obj.GetComponent <Light>(); light.color = Color.red; } else if (getElement.getElement() == 1) { //Nature renderer.material = materials[getElement.getElement()]; Light light = obj.GetComponent <Light>(); light.color = Color.green; } else { //Water renderer.material = materials[getElement.getElement()]; Light light = obj.GetComponent <Light>(); light.color = Color.blue; } }
public void pickElement(GameObject obj) { Renderer renderer = obj.GetComponent <Renderer>(); if (getElement.getElement() == 0) { renderer.material = materials[getElement.getElement()]; } else if (getElement.getElement() == 1) { renderer.material = materials[getElement.getElement()]; } else { renderer.material = materials[getElement.getElement()]; } }