-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGame.cs
60 lines (53 loc) · 1.25 KB
/
Game.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
51
52
53
54
55
56
57
58
59
60
using UnityEngine;
using System.Collections;
using Assets.Scripts.Data;
public class Game : MonoBehaviour {
public int score;
public int lives;
public float evil;
public int levelsUnlocked;
public int enemiesKilled;
public int environsDestroyed;
public bool levelBeaten;
public AdaptablePriorityQueue<string> apq;
// Use this for initialization
void Start () {
Screen.SetResolution(1024, 576, false);
DontDestroyOnLoad(transform.gameObject);
lives = 5;
score = 0;
evil = 0;
levelsUnlocked = 1;
levelBeaten = false;
apq = new AdaptablePriorityQueue<string>();
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.Escape)) {
GameObject play = GameObject.FindGameObjectWithTag("Player");
Debug.Log(play);
if(play!=null) {
lives = play.GetComponentInChildren<Player>().lives;
}
}
if(levelsUnlocked==6) {
levelsUnlocked = 7;
Application.LoadLevel(8);
}
if(lives==0) {
GameObject play = GameObject.FindGameObjectWithTag("Player");
lives = play.GetComponentInChildren<Player>().lives;
if(lives==0) {
lives = 5;
Application.LoadLevel(9);
}
}
}
public void beatLevel() {
if(!levelBeaten) {
score += 10000;
levelsUnlocked++;
}
levelBeaten = true;
}
}