/// <summary> /// /// </summary> /// <param name="motorRpmPercent">0..1 where 1 is max rpms</param> /// <param name="gameTime"></param> public virtual void Update(float motorRpmPercent, GearboxAction action) { if (_gearChange != null) { _gearChange.TimeTillEngaged -= Engine.Instance.FrameTime; if (_gearChange.TimeTillEngaged <= 0) { if (_gearChange.Change > 0) { if (_currentGear < _ratios.Count - 1) { _currentGear++; } } else { if (_currentGear > -1) { _currentGear--; } } _clutch = 1.0f; _gearChange = null; if (GearChangeCompleted != null) { GearChangeCompleted(this, null); } } else { _clutch = (_changeTime - _gearChange.TimeTillEngaged) / _changeTime; } } }
public void GearUp() { if (_gearChange == null) { _gearChange = new GearboxGearChange(); _gearChange.Change = 1; _gearChange.TimeTillEngaged = _changeTime; _clutch = 0.0f; GearChangeStarted(this, null); } }
/// <summary> /// /// </summary> /// <param name="motorRpmPercent">0..1 where 1 is max rpms</param> /// <param name="gameTime"></param> public virtual void Update(float motorRpmPercent, GearboxAction action) { if (_gearChange != null) { _gearChange.TimeTillEngaged -= Engine.Instance.FrameTime; if (_gearChange.TimeTillEngaged <= 0) { if (_gearChange.Change > 0) { if (_currentGear < _ratios.Count - 1) _currentGear++; } else { if (_currentGear > -1) _currentGear--; } _clutch = 1.0f; _gearChange = null; if (GearChangeCompleted != null) GearChangeCompleted(this, null); } else { _clutch = (_changeTime - _gearChange.TimeTillEngaged) / _changeTime; } } }