PageRenderTime 29ms CodeModel.GetById 21ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Scripts/ShovelInteract.js

http://acid-and-base.googlecode.com/
JavaScript | 35 lines | 34 code | 1 blank | 0 comment | 12 complexity | 284f33e783bdd40fbc8d81c9f2de5724 MD5 | raw file
 1var inRange : boolean = false;
 2var showGUI : boolean = false;
 3var ant;
 4
 5function Start ()
 6{
 7	ant = GameObject.Find("AntDialog").GetComponent("Tutorial");
 8}
 9function OnTriggerEnter (col : Collider)
10{
11	var prop : Properties = col.GetComponent("Properties");
12	if(prop == null)
13		return;
14	if(prop.abType == AcidOrBase.Acid && prop.ph < 4)
15		inRange = true;
16}
17function OnTriggerExit (col : Collider)
18{
19	var prop : Properties = col.GetComponent("Properties");
20	if(prop == null)
21		return;
22	if(prop.abType == AcidOrBase.Acid && prop.ph < 4)
23		inRange = false;
24}
25function Update () 
26{
27	if(inRange)
28	{
29		if(Input.GetKeyDown(KeyCode.E))
30		{
31			ant.shovel = true;
32			Destroy(this);
33		}
34	}
35}