public void AddDriver(Vehicle v, DriverStats _stats = null) { if (_stats == null) { _stats = getRandomStats(); } }
static public void addDriverStats(string _name, int _reactionTime, float _followInterval, int _speedRelativeToLimit, float _ruleBreakingChance) { DriverStats _temp = new DriverStats(_name, _reactionTime, _followInterval, _speedRelativeToLimit, _ruleBreakingChance); if (drivertypes.Find(x => x == _temp) == null) { drivertypes.Add(_temp); } General_Form.Main.UserInterface.SimSDM.Selection_box.Add_Element(_temp.Name); }
public AI(Vehicle v, DriverStats _stats) { this.v = v; this.reactionSpeed = _stats.ReactionTime; this.followInterval = _stats.FollowInterval; this.speedRelativeToLimit = _stats.SpeedRelativeToLimit; this.ruleBreakingChance = _stats.RuleBreakingChance; targetspeed = speedlimit + speedRelativeToLimit; //thread used to update vehicle speed and whereabouts in the single threaded car system moveVehicle = new Thread(vehiclemovement); moveVehicle.Start(); }
static public DriverStats getDriverStat(string _name) { DriverStats _temp = drivertypes.Find(x => x.Name == _name); if (_temp == null) { try { _temp = drivertypes[0]; } catch (Exception) { _temp = new DriverStats("", 1, 1, 1, 1); } } return(_temp); }