Beispiel #1
0
 void Start()
 {
     if (progressTracker && progressTracker.GetComponent <GameProgressTracker>())
     {
         processTracker = progressTracker.GetComponent <GameProgressTracker>();
     }
     else
     {
         Debug.Log("Can not find GameProgessTracker.");
     }
 }
Beispiel #2
0
    void Awake()
    {
        //PlayerPrefs.DeleteAll();
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Time.timeScale      = 1f;
        //PlayerPrefs.DeleteAll();
        if (Application.loadedLevel == 0)
        {
            //Initail lock
            //PlayerPrefs.SetInt("level_" + 0, 1);
            for (int i = 1; i < levelNum; i++)
            {
                if (!PlayerPrefs.HasKey("level_" + i))
                {
                    PlayerPrefs.SetInt("level_" + i, 0);
                }
            }

            for (int i = 0; i < levelLock.Length; i++)
            {
                if (PlayerPrefs.HasKey("level_" + i))
                {
                    if (PlayerPrefs.GetInt("level_" + i) == 1)
                    {
                        levelLock[i].SetActive(false);
                    }
                }
            }
        }
        if (progressTracker && progressTracker.GetComponent <GameProgressTracker>())
        {
            processTracker = progressTracker.GetComponent <GameProgressTracker>();
        }
        else
        {
            Debug.Log("Can not find GameProgessTracker.");
        }
    }