// Use this for initialization void Start() { PreviousLevel.setLastLevel(Application.loadedLevelName); obrnjenNaprej = true; player = this.GetComponent <Rigidbody2D>(); mytrans = this.transform; tla = GameObject.Find(this.name + "/tla").transform; respawnPoint = transform.position; gameLevelManager = FindObjectOfType <LevelManager>(); lifeSystem = FindObjectOfType <LifeManager>(); canMove = true; }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); }
void OnGUI() { //if retry button is pressed load scene 0 the game GUI.contentColor = Color.red; if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 + 100, 100, 40), "Retry?")) { //Application.LoadLevel(1); Application.LoadLevel(PreviousLevel.getLastLevel()); } //and quit button if (GUI.Button(new Rect(Screen.width / 2, Screen.height / 2 + 100, 100, 40), "Quit")) { Application.Quit(); } }
public void SwitchCurrentLevel() { if (PreviousLevel == null) { PreviousLevel = CurrentLevel; } else { PreviousLevel.SetActive(false); CurrentLevel = NextLevel; } LevelBehaviour levelBehaviour = CurrentLevel.GetComponent <LevelBehaviour>(); GameObject nextLevel = levelBehaviour.GetPossibleNextLevel(); LevelBehaviour nextLevelBehaviour = CurrentLevel.GetComponent <LevelBehaviour>(); Vector3 nextLevelPosition = levelBehaviour.GetNextLevelPosition(nextLevelBehaviour); NextLevel = Instantiate(nextLevel); NextLevel.transform.position = nextLevelPosition; //////////////////////////////// USING SINGLETON /////////////////////////////////////// ScoreBehaviour.Instance.UpdateScore(); //////////////////////////////// USING SINGLETON /////////////////////////////////////// }
// void Awake() { // Call the LevelManager and set the last level. PreviousLevel.setLastLevel(Application.loadedLevelName); }
public StatusDialog(bool status, String message, NextLevel nextLevel, RetryLevel retryLevel, PreviousLevel previousLevel) { this.message = message; this.status = status; this.nextLevel += nextLevel; this.previousLevel += previousLevel; this.retryLevel = retryLevel; InitializeComponent(); if (status) { init(); complete(); } else { init(); failed(); } }