Exemplo n.º 1
0
        //end of gearing up or downs

        //update method
        public virtual void update(float motorRpmPercent, GameTime gameTime)
        {
            currentState.update(Keyboard.GetState(), gameTime);

            if (gearChange != null)
            {
                gearChange.TimeTillEngaged -= (float)gameTime.ElapsedGameTime.TotalSeconds;

                if (gearChange.TimeTillEngaged <= 0)
                {
                    if (gearChange.Change > 0)
                    {
                        if (currentgear < gearRatios.Count - 1)
                        {
                            currentgear++;
                        }
                    }

                    else
                    if (currentgear > -1)
                    {
                        currentgear--;
                    }

                    clutch     = 1.0f;
                    gearChange = null;
                }

                else
                {
                    clutch = (gearChangetime - gearChange.TimeTillEngaged) / gearChangetime;
                }
            }
        }
Exemplo n.º 2
0
        public void gearDown()
        {
            if (gearChange == null)
            {
                gearChange                 = new GearboxGearChange();
                gearChange.Change          = -1;
                gearChange.TimeTillEngaged = gearChangetime;

                clutch = 0.0f;
            }
        }