コード例 #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);
         }
     }
 }
コード例 #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;
                }
            }
        }
コード例 #3
0
ファイル: BaseGearbox.cs プロジェクト: sikora507/OpenC1
        /// <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;
                }
            }
        }
コード例 #4
0
ファイル: BaseGearbox.cs プロジェクト: sikora507/OpenC1
 public void GearUp()
 {
     if (_gearChange == null)
     {
         _gearChange = new GearboxGearChange();
         _gearChange.Change = 1;
         _gearChange.TimeTillEngaged = _changeTime;
         _clutch = 0.0f;
         if (GearChangeStarted != null) GearChangeStarted(this, null);
     }
 }