Ejemplo n.º 1
0
    void Update()
    {
        if (TimeManager.paused)
        {
            return;
        }

        maxEnergyValue          = PlayerSkills.GetMaxEnergyValue();
        currentEnergyValue      = (float)PlayerEnergy.GetCurrentEnergyValue() / maxEnergyValue;
        energyRadial.fillAmount = currentEnergyValue;
        energyRadial.color      = Color.Lerp(Color.red, Color.green, currentEnergyValue);
        energyText.text         = (currentEnergyValue * maxEnergyValue).ToString();

        if (!SceneManager.GetActiveScene().name.Equals("MainCabin"))
        {
            if (((Input.GetButton("ToolWheel") && !toolWheelIsOpen) || (Input.GetButtonUp("ToolWheel") && toolWheelIsOpen)) && !MenuManager.currentMenuManager.IsInMenu())
            {
                ToggleToolWheel();
            }
        }
        else
        {
            if (!toolsDisabledInside)
            {
                toolIconGroup.parent.transform.parent.gameObject.SetActive(false);
                toolsDisabledInside = true;
            }
        }

        DebugPanel.Log("Current Tool: ", "Player HUD", PlayerTools.GetCurrentlyEquippedToolIndex());
        DebugPanel.Log("Current Tool (manager)", "Player HUD", ToolManager.GetCurrentToolIndex());
    }
Ejemplo n.º 2
0
    public static void Save()
    {
        Debug.Log("Save Slot: " + currentSaveSlot);
        BinaryFormatter data = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + folderPath + currentSaveSlot + saveSlotStrings[currentSaveSlot - 1]);

        SaveableData saveData = new SaveableData();

        //-----------------------Setting Save Data---------------------------------------------
        saveData.activeContracts            = PlayerContracts.GetActiveContractsList();
        saveData.availableContracts         = AvailableContracts.GetAvailableContracts();
        saveData.availableContractsToRemove = AvailableContracts.GetContractsToRemove();

        saveData.didDailyGeneration                = TimeManager.GetDidDailyGeneration();
        saveData.averageContractDifficulty         = AvailableContracts.GetAverageContractDifficulty();
        saveData.pastGeneratedContractDifficulties = AvailableContracts.GetPastGeneratedContractDifficuties();

        saveData.currentEnergy = PlayerEnergy.GetCurrentEnergyValue();

        saveData.currentCurrency          = PlayerResources.GetCurrentCurrencyValue();
        saveData.currentBuildingMaterials = PlayerResources.GetCurrentBuildingMaterialsValue();
        saveData.currentToolParts         = PlayerResources.GetCurrentToolPartsValue();
        saveData.currentBookPages         = PlayerResources.GetCurrentBookPagesValue();

        saveData.homesteadTreesCount    = HomesteadStockpile.GetAllTreesCount();
        saveData.homesteadLogsCount     = HomesteadStockpile.GetAllLogsCount();
        saveData.homesteadFirewoodCount = HomesteadStockpile.GetAllFirewoodCount();

        saveData.ownedTools            = PlayerTools.GetOwnedToolsList();
        saveData.currentlyEquippedTool = PlayerTools.GetCurrentlyEquippedTool();

        saveData.efficiencySkill        = PlayerSkills.GetEfficiencySkill();
        saveData.contractsSkill         = PlayerSkills.GetContractsSkill();
        saveData.currencySkill          = PlayerSkills.GetCurrencySkill();
        saveData.energySkill            = PlayerSkills.GetEnergySkill();
        saveData.buildingMaterialsSkill = PlayerSkills.GetBuildingMaterialsSkill();
        saveData.toolPartsSkill         = PlayerSkills.GetToolPartsSkill();
        saveData.bookPagesSkill         = PlayerSkills.GetBookPagesSkill();
        saveData.lumberTreesSkill       = PlayerSkills.GetLumberTreesSkill();
        saveData.lumberLogsSkill        = PlayerSkills.GetLumberLogsSkill();
        saveData.lumberFirewoodSkill    = PlayerSkills.GetLumberFirewoodSkill();

        saveData.bedRoom      = PlayerRooms.GetBedRoom();
        saveData.kitchenRoom  = PlayerRooms.GetKitchenRoom();
        saveData.officeRoom   = PlayerRooms.GetOfficeRoom();
        saveData.studyRoom    = PlayerRooms.GetStudyRoom();
        saveData.workshopRoom = PlayerRooms.GetWorkshopRoom();

        saveData.coffeeMakerAddition      = PlayerAdditions.GetCoffeeMakerAddition();
        saveData.fireplaceAddition        = PlayerAdditions.GetFireplaceAddition();
        saveData.frontPorchAddition       = PlayerAdditions.GetFrontPorchAddition();
        saveData.woodworkingBenchAddition = PlayerAdditions.GetWoodworkingBenchAddition();

        saveData.currentTime = TimeManager.GetCurrentTime();

        saveData.lastSceneName = SceneManager.GetActiveScene().name;
        Vector3 spawnHolder = SpawnLocations.GetSpawnForLoad(SceneManager.GetActiveScene().name);

        saveData.lastSceneSpawnLocation = new float[3] {
            spawnHolder.x, spawnHolder.y, spawnHolder.z
        };
        //-----------------------Done Setting Data---------------------------------------------
        data.Serialize(file, saveData);
        file.Close();
        Debug.Log("Saved here: " + Application.persistentDataPath);
    }