public override void OnUpdate() { gEngineForce *= (1.0f - FrameDelta); vehicle.ApplyEngineForce(gEngineForce, 2); vehicle.SetBrake(gBreakingForce, 2); vehicle.ApplyEngineForce(gEngineForce, 3); vehicle.SetBrake(gBreakingForce, 3); vehicle.SetSteeringValue(gVehicleSteering, 0); vehicle.SetSteeringValue(gVehicleSteering, 1); base.OnUpdate(); }
public override int Update(float elapsedTime) { gEngineForce *= (1.0f - elapsedTime); vehicle.ApplyEngineForce(gEngineForce, 2); vehicle.SetBrake(gBreakingForce, 0); vehicle.ApplyEngineForce(gEngineForce, 3); vehicle.SetBrake(gBreakingForce, 1); vehicle.SetSteeringValue(gVehicleSteering, 0); vehicle.SetSteeringValue(gVehicleSteering, 1); return(base.Update(elapsedTime)); }
// Moves public void Accelerate() { //Pequeño impulso adicional cuando la velocidad es baja var x = currentSpeed; float f; if (x < 0) { f = 7; } else { f = -FastMath.Log(0.00001f * (x + 0.15f)) - 6.3f; } vehicle.ApplyEngineForce(engineForce * f, 2); vehicle.ApplyEngineForce(engineForce * f, 3); }