//////////////////////////////////////// // On click //void OnMouseDown(){ void switchOnFinger() { //We change the polarity currPolarity = !currPolarity; //We check for the current polarity state switch (currPolarity) { //Becomes red case true: //We change rhe color on the fly Material matRed = Resources.Load(refRedMat, typeof(Material)) as Material; this.renderer.material = matRed; //We change the polarState thePolar = polarState.red; break; //Becomes blue case false: //We change rhe color on the fly Material matBlue = Resources.Load(refBlueMat, typeof(Material)) as Material; this.renderer.material = matBlue; //We change the polarState thePolar = polarState.blue; break; } }
//////////////////////////////////////// // Start void Start() { thePolar = polarState.blue; }