コード例 #1
0
    public void SaveCharacter()
    {
        if (pcName != "" && pcType != "" && pcMotivation != "" && xtra == 0)
        {
            Debug.Log("save the Game for the First time");
            PCharacter pc = new PCharacter(pcName, pcType, pcMotivation, str, dex, iq, wis, per, hlth, aura, face);
            SaveGame.current = new SaveGame(); Debug.Log("Setting up new save game slot");
            SaveGame.current.GROUP.Add(pc); Debug.Log("adding PC to group");
            SaveGame.current.index = -1;
            //Initial Tags
            SaveGame.current.TAGS.Add("Thelmore_Tavern_Open");

            /*            SaveGame.current.thelmoreBank = true; SaveGame.current.thelmoreBarracks = false; SaveGame.current.thelmoreInn = true;
             *              SaveGame.current.thelmoreRoad = false; SaveGame.current.thelmoreSmith = true; SaveGame.current.thelmoreTavern = true;
             *                  SaveGame.current.thelmoreTemple = true; SaveGame.current.thelmoreToolShop = true; SaveGame.current.thelmoreTownHall = false;
             *                      SaveGame.current.thelmoreVoncar = true; SaveGame.current.thelmoreWell = true; Debug.Log("Started bools"); */

            //load rumors
            SaveAndLoad.LoadDefaultRumorList();
            //Create NPCList
            int          randMot, randTyp, randFac;
            string       tempMot = "", tempTyp = "", tempNam = "";
            PCharacter[] NPC = new PCharacter[25];
            for (int i = 0; i < 25; i++)
            {
                //Name
                tempNam = GameManager.GAME.randomName[Random.Range(0, GameManager.GAME.randomName.Count)];
                //Type
                randTyp = Random.Range(1, 4);
                if (randTyp == 1)
                {
                    tempTyp = "Warrior";
                }
                if (randTyp == 2)
                {
                    tempTyp = "Mage";
                }
                if (randTyp == 3)
                {
                    tempTyp = "Rogue";
                }
                //Motivation
                randMot = Random.Range(1, 8);
                if (randMot == 1)
                {
                    tempMot = "Money";
                }
                if (randMot == 2)
                {
                    tempMot = "Power";
                }
                if (randMot == 3)
                {
                    tempMot = "Honor";
                }
                if (randMot == 4)
                {
                    tempMot = "Glory";
                }
                if (randMot == 5)
                {
                    tempMot = "Fate";
                }
                if (randMot == 6)
                {
                    tempMot = "Duty";
                }
                if (randMot == 7)
                {
                    tempMot = "Curiosity";
                }
                if (randMot == 4)
                {
                    tempMot = "Bloodlust";
                }
                randMot = Random.Range(1, 7);
                //Face
                randFac = Random.Range(0, 10);
                //Make NPC
                NPC[i]          = new PCharacter(tempNam, tempTyp, tempMot, randFac);
                NPC[i].motIndex = randMot;
                //Add to SaveGame list
                SaveGame.current.NPCS.Add(NPC[i]);
            }

            SaveAndLoad.Save(); Debug.Log("Saving savegame");
            SceneManager.LoadScene("ThelmoreTown");
        }
        else
        {
            ErrorPanel.SetActive(true);
        }
    }