Exemple #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());
    }
Exemple #2
0
    public static void RestoreEnergyPercentage(float sleepDuration)
    {
        float restorePercentage = sleepDuration / PlayerRooms.GetBedRoomValue();
        int   restoreAmount     = Mathf.RoundToInt(PlayerSkills.GetMaxEnergyValue() * restorePercentage);

        // Debug.Log("Current Energy: " + currentEnergyValue);
        // Debug.Log("Restore Perc: " + restorePercentage);
        // Debug.Log("Resore Min Amount: " + restoreAmount);

        currentEnergyValue = Mathf.Clamp(currentEnergyValue, restoreAmount, PlayerSkills.GetMaxEnergyValue());
    }
Exemple #3
0
    void Start()
    {
        PlayerHudReference = this;

        playerCanvas   = GetComponent <Canvas>();
        maxEnergyValue = PlayerSkills.GetMaxEnergyValue();

        toolIconGroup.parent.transform.parent.gameObject.SetActive(true);
        ChangeToolIcon();

        interactText = interactPrompt.transform.GetChild(3).GetComponent <Text>();
    }
Exemple #4
0
 public static void FullyRestoreEnergy()
 {
     currentEnergyValue = PlayerSkills.GetMaxEnergyValue();
 }
Exemple #5
0
 public static void UpdateCurrentEnergyValue(int changeValue)
 {
     currentEnergyValue = Mathf.Clamp((currentEnergyValue += changeValue), 0, PlayerSkills.GetMaxEnergyValue());
 }
Exemple #6
0
 public static void SetCurrentEnergyValue(int newValue)
 {
     currentEnergyValue = Mathf.Clamp(newValue, 0, PlayerSkills.GetMaxEnergyValue());
 }
Exemple #7
0
    public static void CreateNewSave()
    {
        Debug.Log("Creating New Save in Slot: " + currentSaveSlot);
        BinaryFormatter data = new BinaryFormatter();

        if (!Directory.Exists(Application.persistentDataPath + folderPath + currentSaveSlot + saveSlotStrings[currentSaveSlot - 1]))
        {
            Directory.CreateDirectory(Application.persistentDataPath + folderPath + currentSaveSlot);
        }

        FileStream file = File.Create(Application.persistentDataPath + folderPath + currentSaveSlot + saveSlotStrings[currentSaveSlot - 1]);

        SaveableData saveData = new SaveableData();

        //-----------------------Setting Save Data---------------------------------------------
        saveData.ownedTools = new List <Tool>()
        {
            new Tool(ToolName.EMPTY_HANDS),
            new Tool(ToolName.FELLING_AXE),
            new Tool(ToolName.CROSSCUT_SAW),
            new Tool(ToolName.SPLITTING_AXE)
        };

        saveData.efficiencySkill        = new EfficiencySkill();
        saveData.contractsSkill         = new ActiveContractsSkill();
        saveData.currencySkill          = new CurrencySkill();
        saveData.energySkill            = new EnergySkill();
        saveData.buildingMaterialsSkill = new BuildingMaterialsSkill();
        saveData.toolPartsSkill         = new ToolPartsSkill();
        saveData.bookPagesSkill         = new BookPagesSkill();
        saveData.lumberTreesSkill       = new LumberTreesSkill();
        saveData.lumberLogsSkill        = new LumberLogsSkill();
        saveData.lumberFirewoodSkill    = new LumberFirewoodSkill();

        saveData.bedRoom      = new BedRoom();
        saveData.kitchenRoom  = new KitchenRoom();
        saveData.officeRoom   = new OfficeRoom();
        saveData.studyRoom    = new StudyRoom();
        saveData.workshopRoom = new WorkshopRoom();

        saveData.coffeeMakerAddition      = new CoffeeMakerAddition();
        saveData.fireplaceAddition        = new FireplaceAddition();
        saveData.frontPorchAddition       = new FrontPorchAddition();
        saveData.woodworkingBenchAddition = new WoodworkingBenchAddition();

        saveData.activeContracts            = new List <LumberContract>();
        saveData.availableContracts         = new List <LumberContract>();
        saveData.availableContractsToRemove = new List <int>();

        saveData.didDailyGeneration                = false;
        saveData.averageContractDifficulty         = 2.5f;
        saveData.pastGeneratedContractDifficulties = new List <int>()
        {
            2, 3
        };

        saveData.currentEnergy         = PlayerSkills.GetMaxEnergyValue();
        saveData.currentlyEquippedTool = new Tool(ToolName.EMPTY_HANDS);
        ToolManager.EquipTool(0);

        saveData.currentCurrency          = 0;
        saveData.currentBuildingMaterials = 0;
        saveData.currentToolParts         = 0;
        saveData.currentBookPages         = 0;

        saveData.homesteadTreesCount = new int[5] {
            0, 0, 0, 0, 0
        };
        saveData.homesteadLogsCount = new int[5] {
            0, 0, 0, 0, 0
        };
        saveData.homesteadFirewoodCount = new int[5] {
            0, 0, 0, 0, 0
        };

        saveData.currentTime = 480f;

        saveData.lastSceneName = "MainCabin";
        Vector3 spawnHolder = SpawnLocations.GetSpawnForLoad("MainMenu");

        saveData.lastSceneSpawnLocation = new float[3] {
            spawnHolder.x, spawnHolder.y, spawnHolder.z
        };
        //-----------------------Done Setting Data---------------------------------------------
        data.Serialize(file, saveData);
        file.Close();
        Debug.Log("Finished Saving");
    }