public void RandomReward()
    {
        foreach (UnitWeapon w in CurrentGame.game.memoryGeneral.currentLevel.chestPool.weapons)
        {
            SwordLoader.AssignSword(w.name, w);
        }
        foreach (UnitAssessory a in CurrentGame.game.memoryGeneral.currentLevel.chestPool.assessories)
        {
            AssessoryLoader.AssignAssessory(a.name, a);
        }

        int num = Random.Range(0, 3);

        if (num == 0)
        {
            int num1 = Random.Range(0, CurrentGame.game.memoryGeneral.currentLevel.chestPool.weapons.Count);
            int i    = 0;
            foreach (UnitWeapon w in CurrentGame.game.memoryGeneral.currentLevel.chestPool.weapons)
            {
                if (i == num1)
                {
                    CurrentGame.game.memoryGeneral.itemsOwned.weapons.Add(w);
                    if (!CurrentGame.game.memoryGeneral.shopWares.weapons.Exists(x => x == w))
                    {
                        CurrentGame.game.memoryGeneral.shopWares.weapons.Add(w);
                    }
                    StartCoroutine(Done());
                }
                i++;
            }
        }
        else if (num == 1)
        {
            int num1 = Random.Range(0, CurrentGame.game.memoryGeneral.currentLevel.chestPool.assessories.Count);
            int i    = 0;
            foreach (UnitAssessory a in CurrentGame.game.memoryGeneral.currentLevel.chestPool.assessories)
            {
                if (i == num1)
                {
                    CurrentGame.game.memoryGeneral.itemsOwned.assessories.Add(a);
                    if (!CurrentGame.game.memoryGeneral.shopWares.assessories.Exists(x => x == a))
                    {
                        CurrentGame.game.memoryGeneral.shopWares.assessories.Add(a);
                    }
                    StartCoroutine(Done());
                }
                i++;
            }
        }
        else
        {
            CurrentGame.game.memoryGeneral.gold += CurrentGame.game.memoryGeneral.currentLevel.chestPool.gold;
            StartCoroutine(Done());
        }
    }
Beispiel #2
0
    void OnGUI()
    {
        GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();

        if (currentMenu == Menu.MainMenu)
        {
            GUILayout.Box("Rise Of The Demon Lord");
            GUILayout.Space(10);

            if (GUILayout.Button("New Game"))
            {
                CurrentGame.game = new CurrentGame();
                currentMenu      = Menu.NewGame;
            }

            if (GUILayout.Button("Continue"))
            {
                SaveLoad.Load();
                currentMenu = Menu.Continue;
            }

            if (GUILayout.Button("Delete Save"))
            {
                SaveLoad.Load();
                currentMenu = Menu.Delete;
            }

            if (GUILayout.Button("Quit"))
            {
                Application.Quit();
            }
        }

        else if (currentMenu == Menu.NewGame)
        {
            GUILayout.Box("Name Your Characters");
            GUILayout.Space(10);

            GUILayout.Label("File Name");
            CurrentGame.game.fileName.name = GUILayout.TextField(CurrentGame.game.fileName.name, 20);
            OverGrownLabyrinthTileSet overGrown       = new OverGrownLabyrinthTileSet();
            GrowlingDeepsTileSet      growlingDeeps   = new GrowlingDeepsTileSet();
            FrozenTundraTileSet       frozenTundra    = new FrozenTundraTileSet();
            ScorchingWastesTileSet    scorchingWastes = new ScorchingWastesTileSet();
            overGrown                           = GameObject.Find("LoadMaps").GetComponent <TempDisplayer>().overGrownLabyrinth;
            frozenTundra                        = GameObject.Find("LoadMaps").GetComponent <TempDisplayer>().frozenTundra;
            growlingDeeps                       = GameObject.Find("LoadMaps").GetComponent <TempDisplayer>().growlingDeeps;
            scorchingWastes                     = GameObject.Find("LoadMaps").GetComponent <TempDisplayer>().scorchingWastes;
            CurrentGame.game.overGrown          = overGrown;
            CurrentGame.game.growlingDeeps      = growlingDeeps;
            CurrentGame.game.scorchingWastes    = scorchingWastes;
            CurrentGame.game.frozenTundra       = frozenTundra;
            CurrentGame.game.memoryGeneral.gold = 600;
            GameObject.Find("LoadUnits").GetComponent <UnitLoader>().CreateStartingRoster();
            SwordLoader.StartingInventoryWeapon();
            AssessoryLoader.StartingInventoryAssessory();
            ItemLoader.StartingInventoryItems();
            if (GUILayout.Button("Save"))
            {
                //Save the current Game as a new saved Game


                SaveLoad.Save();
                //Move on to game...=

                SceneManager.LoadScene("Town");
            }

            GUILayout.Space(10);
            if (GUILayout.Button("Cancel"))
            {
                currentMenu = Menu.MainMenu;
            }
        }

        else if (currentMenu == Menu.Continue)
        {
            GUILayout.Box("Select Save File");
            GUILayout.Space(10);

            foreach (CurrentGame g in SaveLoad.savedGames)
            {
                if (GUILayout.Button(g.fileName.name))
                {
                    CurrentGame.game = g;
                    //Move on to game...
                    SaveLoad.currentFile = SaveLoad.savedGames.FindIndex(x => x == g);
                    SceneManager.LoadScene("Town");
                }
            }

            GUILayout.Space(10);
            if (GUILayout.Button("Cancel"))
            {
                currentMenu = Menu.MainMenu;
            }
        }

        else if (currentMenu == Menu.Delete)
        {
            foreach (CurrentGame g in SaveLoad.savedGames)
            {
                if (GUILayout.Button(g.fileName.name))
                {
                    Debug.Log(SaveLoad.savedGames.FindIndex(x => x == g));
                    SaveLoad.currentFile = SaveLoad.savedGames.FindIndex(x => x == g);
                    SaveLoad.Deleted();
                    return;
                }
            }
            GUILayout.Space(10);
            if (GUILayout.Button("Cancel"))
            {
                currentMenu = Menu.MainMenu;
            }
        }


        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }