Exemple #1
0
 // 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);
    }
Exemple #3
0
 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 ///////////////////////////////////////
    }
Exemple #5
0
 //
 void Awake()
 {
     // Call the LevelManager and set the last level.
     PreviousLevel.setLastLevel(Application.loadedLevelName);
 }
Exemple #6
0
        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();
            }
        }