예제 #1
0
    public void AssignBuilding(TownBuilding newBuilding)
    {
        assignedBuilding = newBuilding;

        ShowGeneralInfo();
        if (!newBuilding.IsBuilt())
        {
            ShowIncompletedBuildingInfo();
        }
        else
        {
            ShowCompletedBuildingInfo();
        }
        //Refresh make button
        buildButton.AssignBuilding(newBuilding);
    }
예제 #2
0
    public void BuildBuilding(string buildingID)
    {
        //Get building
        TownBuilding buildingToCheck = allTownBuildings.Find(x => x.buildingName == buildingID);

        if (CanBuildTownBuilding(buildingToCheck))
        {
            Debug.Log("Build it!");
            for (int i = 0; i < buildingToCheck.requiredBuildingResources.Count; i++)
            {
                resourcesMan.SpendResource(buildingToCheck.requiredBuildingResources[i].resourceType, buildingToCheck.requiredBuildingResources[i].resourceVal);
            }
            buildingToCheck.BuildBuilding();
        }
        else
        {
            Debug.Log("Not enough resources");
        }
    }
예제 #3
0
 public BuildingUpgrade(TownBuilding myMainBuilding)
 {
     mainBuilding = myMainBuilding;
 }
예제 #4
0
        public HullRepair(TownBuilding myMainBuilding)
            : base(myMainBuilding)
        {
            name = "Hull Repair";
            icon = SpriteBase.mainSpriteBase.padlockIcon;
            requiredMaterials.Add(CraftRecipe.CraftableItems.ComputerParts, 1);
            buildMoneyCost = 400;

            description = "Restoring hull integrity will improve medical conditions, and also stop people from throwing garbage into the holes in walls.";
            description += "\n\nIncreases daily mercenary heal rate by " + healRateIncrease;
        }
예제 #5
0
        public AirFiltration(TownBuilding myMainBuilding)
            : base(myMainBuilding)
        {
            name = "Air Filtration";
            icon = SpriteBase.mainSpriteBase.padlockIcon;
            requiredMaterials.Add(CraftRecipe.CraftableItems.ComputerParts, 1);
            buildMoneyCost = 400;

            description = "Our docs insist this is necessary for proper quarantine procedures, but I think they're just trying to get air conditioning.";
            description += "\n\nIncreases daily mercenary heal rate by " + healRateIncrease;
        }
예제 #6
0
        public Loader(TownBuilding myMainBuilding)
            : base(myMainBuilding)
        {
            name = "Loader";
            icon = SpriteBase.mainSpriteBase.wrench;
            requiredMaterials.Add(CraftRecipe.CraftableItems.Scrap, 2);
            buildMoneyCost = 100;

            description = "Repairing the old cargo loader will allow us to offload cargo ourselves and save on teamster fees";
            description += "\n\nReduces market purchasing prices by " + (marketPriceReduction * 100) + "%";
        }
예제 #7
0
    public Canteen(TownBuilding myMainBuilding)
        : base(myMainBuilding)
    {
        name = "Canteen";
        icon = SpriteBase.mainSpriteBase.droplet;
        requiredMaterials.Add(CraftRecipe.CraftableItems.Scrap, 2);
        buildMoneyCost = 800;

        description = "Upgrade our canteen (and bar) with fancy, hi-tech habitation systems, such as plumbing and refrigeration.";
        description += "\n\nIncreases the maximum number of hireable mercenaries by " + mercCountIncrease;
    }
예제 #8
0
    // Update is called once per frame
    void Update()
    {
        if (GameDataManager.Instance != null)
        {
            if (GameDataManager.Instance.dataStore.pendingUpgrade_Docks)
            {
                if (upgradeButton.activeInHierarchy)
                {
                    upgradeButton.SetActive(false);
                }
                if (!timerArea.gameObject.activeInHierarchy)
                {
                    timerArea.gameObject.SetActive(true);
                }
                if (cachedPendingUpgradeTimer != GameDataManager.Instance.dataStore.pendingUpgradeTimer_Docks)
                {
                    cachedPendingUpgradeTimer = GameDataManager.Instance.dataStore.pendingUpgradeTimer_Docks;
                    timerArea.text            = PopupMenu.GetTimerReadout(GameDataManager.Instance.dataStore.pendingUpgradeTimer_Docks, GameDataManager.Instance.dataStore.buildingLv_Docks + 1);
                }
            }
            else if (timerArea.gameObject.activeInHierarchy)
            {
                timerArea.gameObject.SetActive(false);
            }
            if (cachedLv != GameDataManager.Instance.dataStore.buildingLv_Docks || cachedPendingUpgradeStatus != GameDataManager.Instance.dataStore.pendingUpgrade_Docks)
            {
                cachedLv = GameDataManager.Instance.dataStore.buildingLv_Docks;
                cachedPendingUpgradeStatus = GameDataManager.Instance.dataStore.pendingUpgrade_Docks;
                headerArea.text            = strings[0] + GameDataManager.Instance.dataStore.buildingLv_Docks.ToString();
                string line0;
                if (GameDataManager.Instance.dataStore.pendingUpgrade_Docks)
                {
                    line0 = strings[4];
                }
                else if (GameDataManager.Instance.dataStore.buildingLv_Docks > TownBuilding.buildingTypeMaxLevels[(int)BuildingType.Docks])
                {
                    line0 = strings[3];
                }
                else
                {
                    line0 = strings[2];
                }
                switch (GameDataManager.Instance.dataStore.buildingLv_Docks)
                {
                case 0:
                    infoArea.text = line0 + System.Environment.NewLine + strings[5];
                    break;

                case 1:
                    infoArea.text = line0 + System.Environment.NewLine + strings[6];
                    break;

                case 2:
                    infoArea.text = line0 + System.Environment.NewLine + strings[7];
                    break;

                case 3:
                    infoArea.text = line0 + System.Environment.NewLine + strings[8];
                    break;

                case 4:
                    infoArea.text = line0 + System.Environment.NewLine + strings[9];
                    break;

                case 5:
                    infoArea.text = line0 + System.Environment.NewLine + strings[10];
                    break;

                case 6:
                    infoArea.text = line0 + System.Environment.NewLine + strings[11];
                    break;

                case 7:
                    infoArea.text = line0 + System.Environment.NewLine + strings[12];
                    break;

                case 8:
                    infoArea.text = line0 + System.Environment.NewLine + strings[13];
                    break;

                case 9:
                    infoArea.text = line0 + System.Environment.NewLine + strings[14];
                    break;

                case 10:
                    infoArea.text = line0 + System.Environment.NewLine + strings[15];
                    break;
                }
                if (GameDataManager.Instance.dataStore.buildingLv_Docks < TownBuilding.buildingTypeMaxLevels[(int)BuildingType.Docks])
                {
                    if (!upgradeButton.activeInHierarchy)
                    {
                        upgradeButton.SetActive(true);
                    }
                    int[] costs = TownBuilding.GetUpgradeCost_Docks(GameDataManager.Instance.dataStore.buildingLv_Docks);
                    bricksCount.text = costs[0].ToString();
                    planksCount.text = costs[1].ToString();
                    metalCount.text  = costs[2].ToString();
                }
                else if (upgradeButton.activeInHierarchy)
                {
                    upgradeButton.SetActive(false);
                }
            }
        }
    }
예제 #9
0
 public void GetBuildingType(int buidlingID)
 {
     building = PlayerInfo.currrentTown.townBuildings[(buidlingID - 1)];
     UpdateAllText();
 }