PageRenderTime 24ms CodeModel.GetById 17ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 1ms

/Scripts/MasterController.js

http://acid-and-base.googlecode.com/
JavaScript | 35 lines | 32 code | 3 blank | 0 comment | 2 complexity | a3da226e95a7ceae4e9d8837457c2785 MD5 | raw file
 1var firstCharacter : GameObject;
 2var secondCharacter : GameObject;
 3var thirdCharacter : GameObject;
 4
 5private var activePlayer : int;
 6
 7function Start () {
 8	activePlayer = 0;
 9	firstCharacter.GetComponent(ModifiedController).enable = true;
10}
11
12function Update () {
13	if(Input.GetButtonDown("Fire3")){
14		switch (activePlayer){
15			case 0:
16				activePlayer = 1;
17				firstCharacter.GetComponent(ModifiedController).enable = false;
18				secondCharacter.GetComponent(ModifiedController).enable = true;
19				thirdCharacter.GetComponent(ModifiedController).enable = false;
20				break;
21			case 1:
22				activePlayer = 2;
23				firstCharacter.GetComponent(ModifiedController).enable = false;
24				secondCharacter.GetComponent(ModifiedController).enable = false;
25				thirdCharacter.GetComponent(ModifiedController).enable = true;
26				break;
27			case 2:
28				activePlayer = 0;
29				firstCharacter.GetComponent(ModifiedController).enable = true;
30				secondCharacter.GetComponent(ModifiedController).enable = false;
31				thirdCharacter.GetComponent(ModifiedController).enable = false;
32				break;
33		}
34	}
35}