// Start is called before the first frame update
 void Start()
 {
     bodyPartManager = FindObjectOfType <BodyPartManager>();
     unlockTracker   = FindObjectOfType <UnlockTracker>();
     PopulateBodyPartsList();
     PopulateOrgansList();
 }
Пример #2
0
    public void DecodeTrackers()
    {
        using (StreamReader r = new StreamReader(@"savegame.json"))
        {
            string   json     = r.ReadToEnd();
            Encoders encoders = JsonUtility.FromJson <Encoders>(json);

            GoldTracker goldTracker = FindObjectOfType <GoldTracker>();
            JsonUtility.FromJsonOverwrite(encoders.goldTracker, goldTracker);

            GameSetupScenarioTracker gameSetupScenarioTracker = FindObjectOfType <GameSetupScenarioTracker>();
            JsonUtility.FromJsonOverwrite(encoders.gameSetupScenarioTracker, gameSetupScenarioTracker);
            gameSetupScenarioTracker.OnLoad();

            UnlockTracker unlockTracker = FindObjectOfType <UnlockTracker>();
            JsonUtility.FromJsonOverwrite(encoders.unlockTracker, unlockTracker);

            PerkTracker perkTracker = FindObjectOfType <PerkTracker>();
            JsonUtility.FromJsonOverwrite(encoders.perkTracker, perkTracker);

            ActionTracker actionTracker = FindObjectOfType <ActionTracker>();
            JsonUtility.FromJsonOverwrite(encoders.actionTracker, actionTracker);

            RandomTracker randomTracker = FindObjectOfType <RandomTracker>();
            JsonUtility.FromJsonOverwrite(encoders.randomTracker, randomTracker);
            randomTracker.OnLoad();
        }
    }
Пример #3
0
    public void GenerateInjuries()
    {
        textLog          = FindObjectOfType <TextLog>();
        bodyPartManager  = FindObjectOfType <BodyPartManager>();
        unlockTracker    = FindObjectOfType <UnlockTracker>();
        gameSetupTracker = FindObjectOfType <GameSetupScenarioTracker>();

        EasyInjuries(gameSetupTracker.easyInjuries);
        MediumInjuries(gameSetupTracker.mediumInjuries);
        HardInjuries(gameSetupTracker.hardInjuries);
        randomIndex = 0;
        randomNumbersReturned.Add(77777);

        try
        {
            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "SampleScene")
            {
                GameObject.FindObjectOfType <BodyPartSelectorManager>().ResetSelectors();
                GameObject.FindObjectOfType <EmbeddedObjectSelectorManager>().ResetSelectors();
            }
        }
        catch (System.Exception e)
        {
            Debug.LogError($"PhysicalInjuryGenertor: Error resetting selectors: {e}");
        }
    }
Пример #4
0
    public void EncodeTrackers()
    {
        GoldTracker              goldTracker              = FindObjectOfType <GoldTracker>();
        UnlockTracker            unlockTracker            = FindObjectOfType <UnlockTracker>();
        ActionTracker            actionTracker            = FindObjectOfType <ActionTracker>();
        RandomTracker            randomTracker            = FindObjectOfType <RandomTracker>();
        GameSetupScenarioTracker gameSetupScenarioTracker = FindObjectOfType <GameSetupScenarioTracker>();
        PerkTracker              perkTracker              = FindObjectOfType <PerkTracker>();

        Encoders encoders = new Encoders();

        encoders.goldTracker              = JsonUtility.ToJson(goldTracker);
        encoders.unlockTracker            = JsonUtility.ToJson(unlockTracker);
        encoders.actionTracker            = JsonUtility.ToJson(actionTracker);
        encoders.randomTracker            = JsonUtility.ToJson(randomTracker);
        encoders.perkTracker              = JsonUtility.ToJson(perkTracker);
        encoders.gameSetupScenarioTracker = JsonUtility.ToJson(gameSetupScenarioTracker);

        string json = JsonUtility.ToJson(encoders);

        System.IO.File.WriteAllText(@"savegame.json", json);
    }