/// <summary> /// Creates a wheel. /// </summary> /// <param name="wheelName"> /// The name of the wheel type you want to create. Should be the same as the filename, minus the extension. Case sensitive! /// </param> public Wheel CreateWheel(string wheelName, WheelID ID, Kart owner, Vector3 position, string meshName) { IDictionary<string, float> dict = wheels[wheelName]; Wheel wheel = new Wheel(owner, position, ID, dict, meshName); return wheel; }
/// <summary> /// Put this in a separate function so we can edit it at runtime, since VS doesn't like us trying to edit anonymous functions /// </summary> private void StopDrifting_WheelFunction(Wheel w) { w.DriftState = WheelDriftState.None; w.IdealSteerAngle = 0f; if (w.ID == WheelID.FrontRight || w.ID == WheelID.FrontLeft) { _vehicle.GetWheelInfo(w.IntWheelID).IsFrontWheel = true; } else { _vehicle.GetWheelInfo(w.IntWheelID).IsFrontWheel = false; } }
/// <summary> /// Put this in a separate function so we can edit it at runtime, since VS doesn't like us trying to edit anonymous functions /// </summary> private void StartDrifting_WheelFunction(Wheel w) { // left if (this.DriftState == KartDriftState.StartLeft) { w.DriftState = WheelDriftState.Left; // change the back wheels' angles if (w.ID == WheelID.FrontRight || w.ID == WheelID.BackRight) { w.IdealSteerAngle = BackDriftAngle; _vehicle.GetWheelInfo(w.IntWheelID).IsFrontWheel = false; } // change the front wheels' angles else { w.IdealSteerAngle = FrontDriftAngle; _vehicle.GetWheelInfo(w.IntWheelID).IsFrontWheel = true; } } // right else if (this.DriftState == KartDriftState.StartRight) { w.DriftState = WheelDriftState.Right; // change the back wheels' angles if (w.ID == WheelID.FrontLeft || w.ID == WheelID.BackLeft) { w.IdealSteerAngle = -BackDriftAngle; _vehicle.GetWheelInfo(w.IntWheelID).IsFrontWheel = false; } // change the front wheels' angles else { w.IdealSteerAngle = -FrontDriftAngle; _vehicle.GetWheelInfo(w.IntWheelID).IsFrontWheel = true; } } }