コード例 #1
0
    void Start()
    {
        switch (name)
        {
        case "Energy":
            associatedSkill = PlayerSkills.GetEnergySkill();
            break;

        case "Currency":
            associatedSkill = PlayerSkills.GetCurrencySkill();
            break;

        case "ActiveContracts":
            associatedSkill = PlayerSkills.GetContractsSkill();
            break;

        case "Efficiency":
            associatedSkill = PlayerSkills.GetEfficiencySkill();
            break;

        case "BuildingMaterials":
            associatedSkill = PlayerSkills.GetBuildingMaterialsSkill();
            break;

        case "ToolParts":
            associatedSkill = PlayerSkills.GetToolPartsSkill();
            break;

        case "BookPages":
            associatedSkill = PlayerSkills.GetBookPagesSkill();
            break;

        case "FelledTrees":
            associatedSkill = PlayerSkills.GetLumberTreesSkill();
            break;

        case "Logs":
            associatedSkill = PlayerSkills.GetLumberLogsSkill();
            break;

        case "Firewood":
            associatedSkill = PlayerSkills.GetLumberFirewoodSkill();
            break;
        }

        skillName        = toolTipGroup.GetChild(0).GetComponent <Text>();
        tierNumber       = toolTipGroup.GetChild(1).GetComponent <Text>();
        skillDescription = toolTipGroup.GetChild(2).GetComponent <Text>();
        tierValue        = toolTipGroup.GetChild(3).GetComponent <Text>();
    }
コード例 #2
0
ファイル: UpgradeSkills.cs プロジェクト: troseberry/Woodlands
    public void UpgradeBuildingMaterials()
    {
        if (PlayerSkills.GetBuildingMaterialsSkill().CanBeUpgraded())
        {
            int currentTier = PlayerSkills.GetCurrentBuildingMaterialsTier();

            if (PlayerSkills.GetBuildingMaterialsSkill().GetDevResourceQuantityAtTier(currentTier + 1).HasInInventory())
            {
                CharacterInputController.InitiateUpgrade(AnimState.UPGRADE_SKILL);

                PlayerSkills.SetCurrentBuildingMaterialsTier(currentTier + 1);
                PlayerSkills.GetBuildingMaterialsSkill().GetDevResourceQuantityAtTier(currentTier + 1).SubtractFromInventory();
                UpdateSkillsResources();
            }
            else
            {
                Debug.Log("Insufficient Resources: " + PlayerSkills.GetBuildingMaterialsSkill().GetDevResourceQuantityAtTier(currentTier + 1));
            }
        }
        else
        {
            Debug.Log("Max Tier Reached: MAX BUILDING MATERIALS");
        }
    }
コード例 #3
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);
    }