/Scripts/AcidColorChange.js
http://acid-and-base.googlecode.com/ · JavaScript · 39 lines · 36 code · 3 blank · 0 comment · 22 complexity · 6eb093c1f6c0af5f1e2c3038fc78509d MD5 · raw file
- function OnControllerColliderHit(hit : ControllerColliderHit) {
- if(hit.gameObject.name == "PseudoEnemy"){
- var component = GameObject.Find("Acid/Acid03");
- var mats = component.renderer.materials;
- var origColor = mats[1].color;
-
- mats[1].color = Color(255/255.0, 0, 0); // Color(R, G, B) - change to red
- yield WaitForSeconds(1.1); // pause for a sec
- mats[1].color =origColor; // change it back
- }
- }
- function Update(){
- var component = GameObject.Find("Acid/Acid03");
- var mats = component.renderer.materials;
- var current_ph = GetComponent(Properties).ph; // get current ph level
-
- if(current_ph == 7){
- mats[1].color = Color(80/255.0,235.0/255.0,63/255.0); // (R, G, B)
- }
- else if(current_ph == 6){
- mats[1].color = Color(171/255.0,255/255.0,0);
- }
- else if(current_ph == 5){
- mats[1].color = Color(1, 1, 0);
- }
- else if(current_ph == 4){
- mats[1].color = Color(255/255.0,222/255.0,0);
- }
- else if(current_ph == 3){
- mats[1].color = Color(255/255.0,125/255.0,0);
- }
- else if(current_ph == 2){
- mats[1].color = Color(255/255.0,100/255.0,0);
- }
- else if(current_ph == 1){
- mats[1].color = Color(166/255.0,28/255.0,0);
- }
- }