示例#1
0
    public void EndofTurn()
    {
        currentProduction.productionLeft -= productionRate * workforce.GetLaborers();

        if (currentProduction.productionLeft <= 0)
        {
            if (currentProduction.rocketType == -1)
            {
                finances.UpdateFunds((int)(productionRate * workforce.GetLaborers() * 0.2f));
                currentProduction.productionLeft = 0;
            }
            else
            {
                turnManager.ShipConstruction(currentProduction.rocketType);
                productionOverflow = currentProduction.productionLeft;
                currentProduction  = new CurrentProduction(0, -1);
            }
        }
    }
示例#2
0
    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);
    }
示例#3
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);
    }