using UnityEngine;
using System.Collections;
public class test1 : MonoBehaviour {
public int MaxScore;
void Awake(){
//PlayerPrefs.SetInt("HISCORE", 100);
//int highScore = PlayerPrefs.GetInt("HISCORE", 0);
DontDestroyOnLoad(gameObject);
}
// Use this for initialization
void Start () {
MaxScore = 1000;
}
// Update is called once per frame
void Update () {
}
void OnGUI(){
if(GUI.Button(new Rect(10, 10, 300, 100), "score")){
MaxScore += 100;
}
if(GUI.Button(new Rect(10, 150, 190, 100), "next Level")){
if(Application.loadedLevel < Application.levelCount - 1)
Application.LoadLevel(Application.loadedLevel + 1);
//Application.LoadLevelAdditive(Application.loadedLevel + 1);
}
if(GUI.Button(new Rect(200, 150, 190, 100), "prev Level")){
if(1 < Application.loadedLevel){
Application.LoadLevel(Application.loadedLevel - 1);
}
}
if(GUI.Button(new Rect(10, 250, 190, 100), "Retry")){
Application.LoadLevel(Application.loadedLevel);
}
/*
if(GUI.Button(new Rect(200, 250, 190, 100), "Additive")){
Application.LoadLevelAdditive("Test4");
}
*/
if(GUI.Button(new Rect(200, 250, 190, 100), "Additive")){
GameObject npc = GameObject.Find("NPC");
if( npc != null)
Destroy (npc);
Application.LoadLevelAdditive("Common");
}
}
}
'Computer Language > 유니티' 카테고리의 다른 글
하스스톤 디딤돌 (0) | 2014.07.01 |
---|---|
SkinnedMeshRenderer (0) | 2014.06.27 |
[System.Serializable] [Range(0, 100)] [HideInInspector] [SerializeField] Script Editor (0) | 2014.06.23 |
[ContextMenu("Arrange")] 활용법 (0) | 2014.06.23 |
진행중 gamecontroller (0) | 2014.06.10 |