public void RoundToInt(string cost) { int itemCost = 0; if (cost[0] == '$') { itemCost = YarnGeneral.IntFromVariableName(cost, ds.Storage); } else { itemCost = Mathf.CeilToInt(float.Parse(cost)); } ds.Storage.SetValue("$rounded_num", itemCost); }
public void CheckAffordability(string cost) { int itemCost = 0; if (cost[0] == '$') { itemCost = YarnGeneral.IntFromVariableName(cost, ds.Storage); } else { itemCost = Mathf.CeilToInt(float.Parse(cost)); } ds.Storage.SetValue("$can_afford", Globals.GameVars.playerShipVariables.ship.currency >= itemCost); }
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(); }