public void PayAmountResources(string cost) { Globals.GameVars.playerShipVariables.ship.currency = 0; ds.UpdateMoney(); for (int i = 0; i < owedResources.Count; i++) { System.Array.Find(Globals.GameVars.playerShipVariables.ship.cargo, x => x.name == owedResources[i].name).amount_kg -= owedResources[i].amount_kg; Debug.Log($"Paying {owedResources[i].amount_kg}kg of {owedResources[i].name}"); } }
public void PayAmount(string cost) { int itemCost = 0; if (cost[0] == '$') { itemCost = YarnGeneral.IntFromVariableName(cost, ds.Storage); } else { itemCost = Mathf.RoundToInt(float.Parse(cost)); } Globals.GameVars.playerShipVariables.ship.currency -= itemCost; ds.UpdateMoney(); }