PageRenderTime 35ms CodeModel.GetById 20ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/Scripts/BaseColorChange.js

http://acid-and-base.googlecode.com/
JavaScript | 41 lines | 31 code | 10 blank | 0 comment | 25 complexity | 6c78fd3242f6bb99840004bb8ac5d777 MD5 | raw file
 1function OnControllerColliderHit(hit : ControllerColliderHit) {
 2	if(hit.gameObject.name == "PseudoEnemy"){
 3		var component = GameObject.Find("Base/Base03");
 4		var mats = component.renderer.materials;
 5		var origColor = mats[1].color;
 6		
 7		mats[1].color = Color(255/255.0, 0, 0); // Color(R, G, B) - change to red
 8		yield WaitForSeconds(1.1); // pause for a sec
 9		mats[1].color = origColor; // change it back	
10	}
11}
12
13function Update () {
14	var component = GameObject.Find("Base/Base03");
15	var mats = component.renderer.materials;
16	current_ph = GetComponent(Properties).ph; // get current ph level
17	
18	if(current_ph == 7)
19		mats[1].color = Color(80/255.0,235.0/255.0,63/255.0); // (R, G, B)
20		
21	else if(current_ph == 8)
22		mats[1].color = Color(0/255.0,225/255.0,135/255.0);
23	
24	else if(current_ph == 9)
25		mats[1].color = Color(0,225/255.0,195/255.0);
26
27	else if(current_ph == 10)
28		mats[1].color = Color(0,210/255.0,225/255.0);
29	
30	else if(current_ph == 11)
31		mats[1].color = Color(0,125/255.0,255/255.0);
32	
33	else if(current_ph == 12)
34		mats[1].color = Color(0,75/255.0,255/255.0);
35	
36	else if(current_ph == 13)
37		mats[1].color = Color(0,75/255.0,255/255.0);
38	
39	else if (current_ph == 14)
40		mats[1].color = Color(0,0,255/255.0);
41}