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