void Start() { var stations = stationMatrix.GetMatrix(); for (int i = 0; i < stations[0].stationMatrices.Length; i++) { var newItem = new TMP_Dropdown.OptionData(); newItem.text = stations[0].stationMatrices[i].from.ToString(); stationSelector.options.Add(newItem); } }
private static bool CalculateTransaction(PassengerData _data, StationMatrix _matrix, StationNames _in, StationNames _out) { foreach (var s in _matrix.GetMatrix()[0].stationMatrices) { if (s.from.Equals(_in)) { foreach (var a in s.stationToStations) { if (a.to.Equals(_out)) { if (_data.balance >= a.price) { float price = a.price == 0? 13: a.price; //Deduct 13 if in and out is the same station _data.balance -= price; return(true); } } } } } return(false); }