示例#1
0
    void Start()
    {
        switch (name)
        {
        case "Kitchen":
            associatedRoom = PlayerRooms.GetKitchenRoom();
            break;

        case "Bedroom":
            associatedRoom = PlayerRooms.GetBedRoom();
            break;

        case "Office":
            associatedRoom = PlayerRooms.GetOfficeRoom();
            break;

        case "Study":
            associatedRoom = PlayerRooms.GetStudyRoom();
            break;

        case "Workshop":
            associatedRoom = PlayerRooms.GetWorkshopRoom();
            break;
        }

        roomName        = toolTipGroup.GetChild(0).GetComponent <Text>();
        tierNumber      = toolTipGroup.GetChild(1).GetComponent <Text>();
        roomDescription = toolTipGroup.GetChild(2).GetComponent <Text>();
        tierValue       = toolTipGroup.GetChild(3).GetComponent <Text>();
    }
示例#2
0
    public void UpgradeKitchen()
    {
        KitchenRoom kitchen = PlayerRooms.GetKitchenRoom();

        if (kitchen.CanBeUpgraded())
        {
            int currentTier = PlayerRooms.GetKitchenRoomTier();

            if (kitchen.GetDevResourceQuantityAtTier(currentTier + 1).HasInInventory())
            {
                PlayerRooms.SetKitchenRoomTier(currentTier + 1);
                kitchen.GetDevResourceQuantityAtTier(currentTier + 1).SubtractFromInventory();
                ShopCanvas.TriggerRoomsInfoUpdate();
            }
            else
            {
                Debug.Log("Insufficient Resources:" + kitchen.GetDevResourceQuantityAtTier(currentTier + 1));
            }
        }
        else
        {
            Debug.Log("Max Tier Reached: KITCHEN ");
        }
    }
示例#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);
    }