Beispiel #1
0
 public void GearDown()
 {
     if (_gearChange == null)
     {
         _gearChange                 = new GearboxGearChange();
         _gearChange.Change          = -1;
         _gearChange.TimeTillEngaged = _changeTime;
         _clutch = 0.0f;
         if (GearChangeStarted != null)
         {
             GearChangeStarted(this, null);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="motorRpmPercent">0..1 where 1 is max rpms</param>
        /// <param name="gameTime"></param>
        public virtual void Update(float motorRpmPercent)
        {
            if (_gearChange != null)
            {
                _gearChange.TimeTillEngaged -= GameEngine.ElapsedSeconds;

                if (_gearChange.TimeTillEngaged <= 0)
                {
                    if (_gearChange.Change > 0)
                    {
                        if (_currentGear < _ratios.Count - 1)
                        {
                            _currentGear++;
                        }
                    }
                    else
                    {
                        if (_currentGear > -1)
                        {
                            _currentGear--;
                        }
                    }
                    if (_currentGear == 1)
                    {
                    }

                    _clutch     = 1.0f;
                    _gearChange = null;
                    if (GearChangeCompleted != null)
                    {
                        GearChangeCompleted(this, null);
                    }
                }
                else
                {
                    _clutch = (_changeTime - _gearChange.TimeTillEngaged) / _changeTime;
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="motorRpmPercent">0..1 where 1 is max rpms</param>
        /// <param name="gameTime"></param>
        public virtual void Update(float motorRpmPercent)
        {
            if (_gearChange != null)
            {
                _gearChange.TimeTillEngaged -= Engine.ElapsedSeconds;

                if (_gearChange.TimeTillEngaged <= 0)
                {
                    if (_gearChange.Change > 0)
                    {
                        if (_currentGear < _ratios.Count - 1)
                            _currentGear++;
                    }
                    else
                    {
                        if (_currentGear > -1)
                            _currentGear--;
                    }
                    if (_currentGear == 1)
                    {
                    }

                    _clutch = 1.0f;
                    _gearChange = null;
                    if (GearChangeCompleted != null) GearChangeCompleted(this, null);
                }
                else
                {
                    _clutch = (_changeTime - _gearChange.TimeTillEngaged) / _changeTime;
                }
            }
        }
Beispiel #4
0
 public void GearUp()
 {
     if (_gearChange == null)
     {
         _gearChange = new GearboxGearChange();
         _gearChange.Change = 1;
         _gearChange.TimeTillEngaged = _changeTime;
         _clutch = 0.0f;
         if (GearChangeStarted != null) GearChangeStarted(this, null);
     }
 }