예제 #1
0
    // Debugger menu
    public void OnGUI()
    {
        // Turn on debugger only if Debugger is true
        if (!Debugger)
        {
            return;
        }

        GUILayout.BeginArea(new Rect(0, 0, Screen.width / 6, Screen.height));

        GUILayout.Label("Dungeon");
        GUILayout.Label("Current floor: " + DataMain.Current.playerData.currentFloorLevel);
        GUILayout.Space(10);

        if (GUILayout.Button("Next"))
        {
            if (DataMain.Current.playerData.UpdateCurrentFloor(true))
            {
                sceneFader.FadeToLevel(DataMain.Current.playerData.GetSceneIndex());
            }
        }

        if (GUILayout.Button("Previous"))
        {
            if (DataMain.Current.playerData.UpdateCurrentFloor(false))
            {
                sceneFader.FadeToLevel(DataMain.Current.playerData.GetSceneIndex());
            }
        }

        if (GUILayout.Button("Town"))
        {
            DataMain.Current.playerData.WrapToFloor(0);
            sceneFader.FadeToLevel(DataMain.Current.playerData.GetSceneIndex());
        }

        if (GUILayout.Button("Add exp"))
        {
            DataMain.Current.playerData.GainExp(10);
            Debug.Log("Current: " + DataMain.Current.playerData.exp +
                      " Needed: " + DataMain.Current.playerData.expLeft +
                      " Ratio: " + DataMain.Current.playerData.expRatio);
        }

        GUILayout.Label("Saving and quiting");
        GUILayout.Space(10);

        if (GUILayout.Button("Save"))
        {
            // Update player position in player data and save player stats
            DataMain.Current.playerData.UpdateCurrentPosition(playerAgent.transform.position);
            DataMain.Current.playerData.SaveStats();

            GameSystemUtilities.Save();
        }

        GUILayout.EndArea();
    }
예제 #2
0
    // Debugger menu
    public void OnGUI()
    {
        // Turn on debugger only if Debugger is true
        if (!Debugger)
        {
            return;
        }

        GUILayout.BeginArea(new Rect(0, 0, Screen.width / 6, Screen.height));

        GUILayout.Label("Town");
        GUILayout.Label("Current floor: " + DataMain.Current.playerData.currentFloorLevel);
        GUILayout.Space(10);

        if (GUILayout.Button("Next"))
        {
            if (DataMain.Current.playerData.UpdateCurrentFloor(true))
            {
                sceneFader.FadeToLevel(DataMain.Current.playerData.GetSceneIndex());
            }
        }

        if (GUILayout.Button("Previous"))
        {
            if (DataMain.Current.playerData.UpdateCurrentFloor(false))
            {
                sceneFader.FadeToLevel(DataMain.Current.playerData.GetSceneIndex());
            }
        }

        GUILayout.Label("Saving and quiting");
        GUILayout.Space(10);

        if (GUILayout.Button("Save"))
        {
            // Update player position in player data and save player stats
            DataMain.Current.playerData.UpdateCurrentPosition(playerAgent.transform.position);
            DataMain.Current.playerData.SaveStats();

            GameSystemUtilities.Save();
        }

        if (GUILayout.Button("Quit"))
        {
#if UNITY_EDITOR
            UnityEditor.EditorApplication.isPlaying = false;
#else
            Application.Quite();
#endif
        }

        GUILayout.EndArea();
    }
예제 #3
0
    // Go back to main menu
    public void GoToMenu()
    {
        Time.timeScale = 1.0f;

        DataMain.Current.IsLoadedGame = true;
        GameSystemUtilities.Save();

        sceneFader.FadeToLevel(0);
    }
    // Create new character with given name
    public void CreateNewSave(TextMeshProUGUI input)
    {
        string playerName = input.text;

        if (!(playerName.Length - 1 == 0))
        {
            // Create a new main data. This only happens if a new game is pressed
            DataMain.Current = new DataMain();

            // Set up player name then put index 0 in level array to true
            DataMain.Current.playerData.playerName = playerName;

            // Save main data to save file, then load scene
            GameSystemUtilities.Save();

            // Load Scene
            sceneFader.FadeToLevel(DataMain.Current.playerData.GetSceneIndex());

            Debug.Log("New Game");
        }
    }
예제 #5
0
 // Go to next/previous level
 public void SelectLevel(bool direction)
 {
     DataMain.Current.playerData.UpdateCurrentFloor(direction);
     sceneFader.FadeToLevel(DataMain.Current.playerData.GetSceneIndex());
     Toggle();
 }