Nextrek
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 GlobalObject : MonoBehaviour
{
public static GlobalObject Instance;
public int nowLevel;
public int shipType;
public bool showMap = false;
private bool pressEnter = false;
void Awake()
{
Instance = this;
nowLevel = PlayerPrefs.GetInt("PlayerFinishedLevel",0);
}
void Start()
{
DontDestroyOnLoad(gameObject);
}
public void WinThisLevel(bool win)
{
GlobalObject.Instance.showMap = true;
if(win)
{
nowLevel++;
PlayerPrefs.SetInt("PlayerFinishedLevel",nowLevel);
if(StartGameUI.currentLanguage == 0)
MessageWindow.Instance.NewMessage("You have finished this level,press 'Enter' to continue");
if(StartGameUI.currentLanguage == 1)
MessageWindow.Instance.NewMessage("Livello completato, spingi 'Enter' per continuare");
}
else
{
if(StartGameUI.currentLanguage == 0)
MessageWindow.Instance.NewMessage("You lose,press 'Enter' to continue;");
if(StartGameUI.currentLanguage == 1)
MessageWindow.Instance.NewMessage("Hai perso,spingi 'Enter' per continuare;");
}
pressEnter = true;
}
void Update()
{
if(pressEnter&&Input.GetKeyDown(KeyCode.Return))
{
pressEnter = false;
Application.LoadLevelAsync("SpaceMap");
}
}
}
|