示例#1
0
    public void Play()
    {
        int level = SaveLoader.LoadProgress().Level;

        level = Mathf.Clamp(level, 1, SceneManager.sceneCountInBuildSettings);
        SceneManager.LoadScene(level);
    }
示例#2
0
    void Start()
    {
        currentSettings = SaveLoader.LoadSettings();
        currentProgress = SaveLoader.LoadProgress();

        SubscribeToEvents();

        if (currentProgress.Level == currentLevel)
        {
            // for (int i = 0; i < currentProgress.COINs; i++) onLanternLited?.Invoke();
            if (currentProgress.COINs == 3)
            {
                OpenLevelDoor();
            }
        }
        else
        {
            OnNextLevelEnter();
        }

        onAssignCheckpoint?.Invoke(currentProgress.LastCheckpoint);

        onGameStarted?.Invoke(currentProgress);

        Debug.Log(currentProgress.COINs);
    }
示例#3
0
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("Clear progress"))
        {
            SaveLoader.SaveProgress(new Progress());
        }

        if (GUILayout.Button("Log current progress to console"))
        {
            Debug.Log(SaveLoader.LoadProgress());
        }

        DrawDefaultInspector();
    }
示例#4
0
    void Start()
    {
        progress = SaveLoader.LoadProgress();

        switch (progress.Level)
        {
        case 0:
            goto case 1;

        case 1:
            doors[1].GetComponent <Image>().sprite        = imageNull;
            doors[1].GetComponent <Button>().interactable = false;
            goto case 2;

        case 2:
            doors[2].GetComponent <Image>().sprite        = imageNull;
            doors[2].GetComponent <Button>().interactable = false;
            break;
        }
    }