예제 #1
0
파일: Production.cs 프로젝트: dnpi314/LD42
    public void StartProduction(int t)
    {
        if (!rocketTypes[t].Unlocked)
        {
            Debug.LogError("Rocket not Unlocked");
            return;
        }

        if (currentProduction.rocketType != -1)
        {
            ErrorTooltip.OpenTooltip("Rocket already under construction");
            return;
        }

        if (rocketTypes[t].GetBuildCost() > finances.DisplayFunds())
        {
            ErrorTooltip.OpenTooltip("Not enough funds");
            return;
        }

        finances.UpdateFunds(-rocketTypes [t].GetBuildCost());
        currentProduction = new CurrentProduction(rocketTypes [t].GetProductionCost(), t);
        currentProduction.productionLeft += productionOverflow;
        productionOverflow = 0;
    }
예제 #2
0
    public bool UpdateLabor(int change)
    {
        if (finances.DisplayFunds() < change * laborerHireCost && change > 0)
        {
            return(false);
        }

        laborers += change;

        if (change > 0)
        {
            finances.UpdateFunds(-change * laborerHireCost);
        }
        if (change < 0)
        {
            finances.UpdateFunds(-change * laborerHireCost / 2);
        }

        finances.UpdateExpenses(change * laborerCost);

        return(true);
    }
예제 #3
0
파일: TurnManager.cs 프로젝트: dnpi314/LD42
    public void ShipLaunch(GameObject go)
    {
        var launch = go.GetComponent <Launch> ();

        if (launch.GetLaunchCost() > finances.DisplayFunds())
        {
            ErrorTooltip.OpenTooltip("Not enough funds");
            return;
        }

        finances.UpdateFunds(-launch.GetLaunchCost());
        worldPopulation.UpdatePopulation(-launch.GetCapacity());
        finances.UpdateIncome(0);
        Destroy(go);
    }
예제 #4
0
파일: Display.cs 프로젝트: dnpi314/LD42
    void Update()
    {
        populationDisplay.text = string.Format("{0}B ({1})", worldPopulation.DisplayPopulation(), worldPopulation.DisplayChange());

        if (production.GetProductionType() == -1)
        {
            int profit = finances.GetChange();
            profit += production.GetWealthProduction();
            string displayChange = "";

            if (profit > 0)
            {
                displayChange = "+" + profit;
            }
            else
            {
                displayChange = profit.ToString();
            }

            moneyDisplay.text = string.Format("{0}M ({1})", finances.DisplayFunds(), displayChange);
        }
        else
        {
            moneyDisplay.text = string.Format("{0}M ({1})", finances.DisplayFunds(), finances.DisplayChange());
        }

        laborerDisplay.text    = string.Format("Laborers: {0}K\nCost: -{1}M p/t", workforce.GetLaborers(), workforce.GetLaborerCost());
        researcherDisplay.text = string.Format("Researchers: {0}K\nCost: -{1}M p/t", workforce.GetResearchers(), workforce.GetResearcherCost());
        planningDisplay.text   = string.Format("Family Planning Centers: {0}K\nCost: -{1}M p/t", workforce.GetPlanning(), workforce.GetPlanningCost());
        donationDisplay.text   = string.Format("Donation Centers: {0}K", workforce.GetDonations());

        switch (production.GetProductionType())
        {
        case -1:
            productionTypeDisplay.text = "Consumer Goods";
            break;

        case 0:
            productionTypeDisplay.text = "Basic Colony Ship";
            break;

        case 1:
            productionTypeDisplay.text = "Advanced Colony Ship";
            break;

        case 2:
            productionTypeDisplay.text = "Mega Colony Ship";
            break;

        case 3:
            productionTypeDisplay.text = "Colony Ark";
            break;

        default:
            productionTypeDisplay.text = "None";
            break;
        }

        if (production.GetProductionType() == -1)
        {
            productionRemainingDisplay.text = string.Format("+{0}M Funds", production.GetWealthProduction());
        }
        else
        {
            productionRemainingDisplay.text = string.Format("Remaining: {0}P (-{1})", production.GetProductionLeft(), production.GetProductionRate());
        }

        researchDisplay.text   = string.Format("{0} (+{1})", research.GetResearchPoints(), workforce.GetResearchers());
        manCostDisplay.text    = string.Format("{0}", research.GetResearchCost(0));
        manLevelDisplay.text   = research.GetResearchLevel(0).ToString();
        cryCostDisplay.text    = string.Format("{0}", research.GetResearchCost(1));
        cryLevelDisplay.text   = research.GetResearchLevel(1).ToString();
        birthCostDisplay.text  = string.Format("{0}", research.GetResearchCost(2));
        birthLevelDisplay.text = research.GetResearchLevel(2).ToString();
        campCostDisplay.text   = string.Format("{0}", research.GetResearchCost(3));
        campLevelDisplay.text  = research.GetResearchLevel(3).ToString();

        yearDisplay.text = string.Format("{0} CE", turn);
    }