-
Notifications
You must be signed in to change notification settings - Fork 1
/
gameover.cs
50 lines (37 loc) · 1.44 KB
/
gameover.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using UnityEngine;
using System.Collections;
public class gameover : MonoBehaviour
{
public GUISkin _menu_skin;
private Rect _rect_credits = new Rect(160, 400, 100, 30);
private Rect _rect_credits_text = new Rect(160, 400, 200, 100);
public GameObject[] way_prefabs;
void Start()
{
_rect_credits.x = (Screen.width-100)*0.5f;
_rect_credits.y = (Screen.height-30)*0.5f + 50;
_rect_credits_text.x = (Screen.width-200)*0.5f;
_rect_credits_text.y = (Screen.height-50)*0.5f - 100;
Screen.lockCursor = false;
GameObject obj;
int i = Random.Range(0, way_prefabs.Length);
obj = (GameObject)Instantiate(way_prefabs[i], new Vector3(0, 0, -20), Quaternion.Euler(0, 0, 0));
obj.GetComponent<tile>().dont_wait_spawning = true;
obj = (GameObject)Instantiate(way_prefabs[i], new Vector3(0, 0, -10), Quaternion.Euler(0, 0, 0));
obj.GetComponent<tile>().dont_wait_spawning = true;
obj = (GameObject)Instantiate(way_prefabs[i], new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0));
obj.GetComponent<tile>().dont_wait_spawning = true;
}
void Update()
{
}
void OnGUI()
{
GUI.skin = _menu_skin;
GUI.skin.label.alignment = TextAnchor.UpperCenter;
GUI.Label(_rect_credits_text, "You failed in your quest. The mages rule the dungeon now...");
GUI.skin.label.alignment = TextAnchor.UpperLeft;
if (GUI.Button(_rect_credits, "Try again"))
Application.LoadLevel(0);
}
}