SHOW:
|
|
- or go back to the newest paste.
1 | #pragma strict | |
2 | - | var selection: int; |
2 | + | |
3 | - | function Start () { |
3 | + | var selection : int; |
4 | - | selection = 0; |
4 | + | |
5 | function Start() | |
6 | { | |
7 | - | function Update () |
7 | + | selection = 0; |
8 | } | |
9 | ||
10 | - | if(Input.GetKeyDown(KeyCode.DownArrow)) |
10 | + | function Update() |
11 | { | |
12 | - | selection++; |
12 | + | if (Input.GetKeyDown(KeyCode.DownArrow)) |
13 | { | |
14 | - | else if(Input.GetKeyDown(KeyCode.UpArrow)) |
14 | + | selection++; |
15 | } | |
16 | - | selection--; |
16 | + | else if (Input.GetKeyDown(KeyCode.UpArrow)) |
17 | { | |
18 | - | switch(selection) |
18 | + | selection--; |
19 | } | |
20 | - | case -1: |
20 | + | |
21 | - | selection = 2; |
21 | + | switch (selection) |
22 | { | |
23 | - | |
23 | + | case -1: |
24 | - | case 0: |
24 | + | selection = 2; |
25 | - | //new game highlighted |
25 | + | |
26 | - | if(Input.GetKeyDown(KeyCode.Space)) |
26 | + | |
27 | - | { |
27 | + | case 0: |
28 | - | NewGame(); |
28 | + | //new game highlighted |
29 | - | } |
29 | + | if(Input.GetKeyDown(KeyCode.Space)) |
30 | { | |
31 | - | |
31 | + | NewGame(); |
32 | - | case 1: |
32 | + | |
33 | - | //load game highlighted |
33 | + | |
34 | - | if(Input.GetKeyDown(KeyCode.Space)) |
34 | + | |
35 | - | { |
35 | + | case 1: |
36 | - | LoadGame(); |
36 | + | //load game highlighted |
37 | - | } |
37 | + | if(Input.GetKeyDown(KeyCode.Space)) |
38 | { | |
39 | - | |
39 | + | LoadGame(); |
40 | - | case 2: |
40 | + | |
41 | - | //exit game highlighted |
41 | + | |
42 | - | if(Input.GetKeyDown(KeyCode.Space)) |
42 | + | |
43 | - | { |
43 | + | case 2: |
44 | - | ExitGame(); |
44 | + | //exit game highlighted |
45 | - | } |
45 | + | if(Input.GetKeyDown(KeyCode.Space)) |
46 | { | |
47 | - | |
47 | + | ExitGame(); |
48 | - | case 3: |
48 | + | |
49 | - | selection = 0; |
49 | + | |
50 | ||
51 | - | |
51 | + | case 3: |
52 | selection = 0; | |
53 | break; | |
54 | } | |
55 | } | |
56 | ||
57 | function OnGUI() | |
58 | - | |
58 | + | |
59 | - | if(selection == 0) |
59 | + | if (selection == 0) |
60 | { | |
61 | - | GUI.color = Color.yellow; |
61 | + | GUI.color = Color.yellow; |
62 | } | |
63 | - | GUI.color = Color.white; |
63 | + | else |
64 | { | |
65 | - | GUI.color = Color.white; |
65 | + | GUI.color = Color.white; |
66 | } | |
67 | - | |
67 | + | |
68 | ||
69 | - | else if (selection == 1) |
69 | + | |
70 | if (selection == 1) | |
71 | - | GUI.color = Color.white; |
71 | + | { |
72 | GUI.color = Color.yellow; | |
73 | - | GUI.color = Color.yellow; |
73 | + | } |
74 | else | |
75 | - | GUI.color = Color.white; |
75 | + | { |
76 | GUI.color = Color.white; | |
77 | - | |
77 | + | } |
78 | - | |
78 | + | |
79 | ||
80 | - | else if(selection == 2) |
80 | + | |
81 | if (selection == 2) | |
82 | - | |
82 | + | { |
83 | - | GUI.color = Color.white; |
83 | + | GUI.color = Color.yellow; |
84 | } | |
85 | - | GUI.color = Color.white; |
85 | + | else |
86 | { | |
87 | - | GUI.color = Color.yellow; |
87 | + | GUI.color = Color.white; |
88 | } | |
89 | - | |
89 | + | |
90 | } | |
91 | ||
92 | ||
93 | function NewGame() | |
94 | { | |
95 | //new game | |
96 | Debug.Log("New Game"); | |
97 | } | |
98 | ||
99 | function LoadGame() | |
100 | { | |
101 | //load game | |
102 | Debug.Log("Load Game"); | |
103 | } | |
104 | ||
105 | function ExitGame() | |
106 | { | |
107 | //exit game | |
108 | Debug.Log("Exit Game"); | |
109 | } |