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; }
public void UnlockShip(int i) { if (!production.UnlockShip(i, research)) { ErrorTooltip.OpenTooltip("Not enough rp"); return; } unlockButtons [i - 1].SetActive(false); buildButtons [i - 1].SetActive(true); }
public bool ResearchLevel(int i) { switch (i) { case 0: if (GetResearchCost(i) > researchPoints) { ErrorTooltip.OpenTooltip("Not enough rp"); return(false); } researchPoints -= GetResearchCost(i); researchLevels[i]++; production.UpdateProductionRate(researchLevels[i]); return(true); case 1: if (GetResearchCost(i) > researchPoints) { ErrorTooltip.OpenTooltip("Not enough rp"); return(false); } researchPoints -= GetResearchCost(i); researchLevels[i]++; production.UpdateCapacity(researchLevels[i]); return(true); case 2: if (GetResearchCost(i) > researchPoints) { ErrorTooltip.OpenTooltip("Not enough rp"); return(false); } researchPoints -= GetResearchCost(i); researchLevels [i]++; workforce.UpdatePlanningStrength(researchLevels [i]); return(true); case 3: if (GetResearchCost(i) > researchPoints) { ErrorTooltip.OpenTooltip("Not enough rp"); return(false); } researchPoints -= GetResearchCost(i); researchLevels [i]++; workforce.UpdateDonationStrength(researchLevels [i]); return(true); default: Debug.LogError("Not a valid research"); return(false); } }
public void PlanningPurchace(int n) { if (n < 0 && workforce.GetPlanning() == 0) { ErrorTooltip.OpenTooltip("None Left"); return; } if (!workforce.UpdatePlanning(n)) { //TODO Display error tooltip ErrorTooltip.OpenTooltip("Not enough funds"); } }
public void DonationPurchace(int n) { if (n < 0 && workforce.GetDonations() == 0) { ErrorTooltip.OpenTooltip("None Left"); return; } if (!workforce.UpdateDonation(n)) { //TODO Display error tooltip ErrorTooltip.OpenTooltip("Not enough funds"); } }
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); }
public void ResearchPurchace(int n) { if (n < 0 && workforce.GetResearchers() == 0) { ErrorTooltip.OpenTooltip("None Left"); return; } if (n < 0 && workforce.GetResearchers() < 5) { n = -workforce.GetResearchers(); } if (!workforce.UpdateResearch(n)) { //TODO Display error tooltip ErrorTooltip.OpenTooltip("Not enough funds"); } }
public void LaborPurchace(int n) { if (n < 0 && workforce.GetLaborers() == 0) { ErrorTooltip.OpenTooltip("None Left"); return; } if (n < 0 && workforce.GetLaborers() < 10) { n = -workforce.GetLaborers(); } if (!workforce.UpdateLabor(n)) { //TODO Display error tooltip ErrorTooltip.OpenTooltip("Not enough funds"); } }