public Wheel(Balder.Core.Application application, WheelType type) { this._application = application; this._roll = new Sprite(); this._roll.AddRange(new ImageRange { FrameCount = 10, ArchivePath = this.GetAssetName(type), FileName = this.GetFileName(type), FileType = "png", NumberingFormat = "{0:00000}", ImageWidth = 32, ImageHeight = 64, }); this._roll.Position = this.GetPosition(type); this._roll.Visibility = Visibility.Collapsed; application.Viewport.Scene.Nodes.Add(this._roll); this.Symbol = new Symbol(type); application.Viewport.Scene.Nodes.Add(this.Symbol); this.Symbol.Visibility = Visibility.Collapsed; this.IsHeld = false; this.WheelType = type; }
public Wheel(WheelType type) { _type = type; switch (_type) { case WheelType.Wheel4: _nPositions = 4; _filterSize = FilterSize.ThreeInch; break; case WheelType.Wheel8: _nPositions = 8; _filterSize = FilterSize.TwoInch; break; case WheelType.WheelUnknown: _nPositions = 1; _filterSize = FilterSize.Unknown; break; } _positions = new FWPosition[_nPositions]; _targetPosition = -1; _name = _type.ToString(); for (int i = 0; i < _nPositions; i++) { _positions[i].filterName = _positions[i].tag = string.Empty; } _position = -1; }
public void ChangeHoldState(WheelType type) { Wheel wheel = null; switch (type) { case WheelType.Left: { wheel = this.LeftWheel; } break; case WheelType.Center: { wheel = this.CenterWheel; } break; case WheelType.Right: { wheel = this.RightWheel; } break; } if (null != wheel) { wheel.ChangeHoldState(); } }
/// <summary> /// Adds a wheel to the BRaycastVehicle from the given information. /// </summary> /// <param name="connectionPoint"></param> /// <param name="axle"></param> /// <param name="suspensionRestLength"></param> /// <param name="radius"></param> /// <returns></returns> public int AddWheel(WheelType wheelType, BulletSharp.Math.Vector3 connectionPoint, BulletSharp.Math.Vector3 axle, float suspensionRestLength, float radius) { float slidingFriction = DefaultSlidingFriction; switch (wheelType) { case WheelType.MECANUM: slidingFriction = 0.1f; axle = (Quaternion.AngleAxis((connectionPoint.X > 0 && connectionPoint.Z > 0) || (connectionPoint.X < 0 && connectionPoint.Z < 0) ? -45 : 45, Vector3.up) * axle.ToUnity()).ToBullet(); break; case WheelType.OMNI: slidingFriction = 0.1f; break; } RobotWheelInfo wheel = RaycastRobot.AddWheel(connectionPoint, -BulletSharp.Math.Vector3.UnitY, axle, suspensionRestLength, radius, defaultVehicleTuning, false); wheel.RollInfluence = RollInfluence; wheel.SlidingFriction = slidingFriction; return(RaycastRobot.NumWheels - 1); }
protected Plane(string name, MotorType motor, WingType wing, WheelType wheel) { this._name = name; this._motor = motor; this._wheel = wheel; this._wing = wing; }
public static void CheckWheelType(WheelType type) { //TODO: Check if it's not blank or without pawn // if (type!=) // { // } }
public Symbol(WheelType type) { this._image = new ImagePrimitive(); this._image.Width = 32; this._image.Height = 32; this._random = new Random(); this._image.YPosition = 50; this.Randomize(); this.SetPosition(type); }
private void SetWheelType(WheelType wheel, bool set) { if (set) { this.team.PitData2014.WheelType |= wheel; } else { this.team.PitData2014.WheelType &= ~wheel; } }
public Wheel getWheel(WheelType type) { foreach (Wheel w in wheels) { if (w.type == type) { return(w); } } return(null); }
/// <summary> /// Deploy or retract all wheels of the given type. /// </summary> void DeployWheels(WheelType wheelType, bool state) { foreach (var part in InternalVessel.parts) { foreach (var deployment in part.FindModulesImplementing <ModuleWheels.ModuleWheelDeployment>()) { var gear = part.Modules[deployment.baseModuleIndex] as ModuleWheelBase; if (gear != null && gear.wheelType == wheelType) { deployment.ActionToggle(new KSPActionParam(0, state ? KSPActionType.Activate : KSPActionType.Deactivate)); } } } }
protected Wheel(WheelType wheelType, int[] map, int[] notches) { this.WheelType = wheelType; EnableNotch = true; if (map.Length != 26) throw new ArgumentException(); Mapping = map; Notches = notches; ReverseMapping = new int[26]; for (int i = 0; i < map.Length; i++) { var reverseNum = i + map[i]; if (reverseNum < 0 || reverseNum > 25) throw new InvalidOperationException(); ReverseMapping[reverseNum] = -map[i]; } }
public BombeEnigma(WheelType[] wheelTypes, ReflectorType reflectorType, int stepsAhead, Bus leftBus, Bus rightBus) : base(wheelTypes, reflectorType) { this.StepsAheadOfKey = stepsAhead; foreach (var wheel in Wheels) { wheel.EnableNotch = false; } this.LeftBus = leftBus; LeftBus.EnigmaConnected = true; LeftBus.SignalEvent += LeftBus_SignalEvent; this.RightBus = rightBus; RightBus.EnigmaConnected = true; RightBus.SignalEvent += RightBus_SignalEvent; }
public JointData(AssemblyJoint joint, String name) {// set all the default values Name = name; jointOfType = joint; try { ReferenceKeyManager refKeyMgr = StandardAddInServer.m_inventorApplication.ActiveDocument.ReferenceKeyManager; byte[] refKey = new byte[0]; joint.GetReferenceKey(ref refKey, 0); RefKey = refKeyMgr.KeyToString(refKey); } catch (Exception e) { MessageBox.Show(e.ToString()); } Driver = DriveTypes.NoDriver; Wheel = WheelType.NotAWheel; Friction = FrictionLevel.None; Diameter = InternalDiameter.PointFive; Pressure = Pressure.psi60; Stages = Stages.SingleStageElevator; PWMport = 1; PWMport2 = 1; CANport = 1; CANport2 = 1; DriveWheel = false; PWM = true; InputGear = 1; OutputGear = 1; SolenoidPortA = 1; SolenoidPortB = 1; RelayPort = 1; HasBrake = false; BrakePortA = 1; BrakePortB = 1; if (joint.Definition.JointType == AssemblyJointTypeEnum.kCylindricalJointType || joint.Definition.JointType == AssemblyJointTypeEnum.kSlideJointType) {// if the assembly joint is linear Rotating = false; } else {// set the combo box choices to rotating Rotating = true; } HasLimits = false; JointFrictionLevel = 0; HasJointFriction = false; }
//Reads the position of the wheel from the file. protected override void ReadDataInternal(BinaryReader reader) { type = (WheelType)reader.ReadByte(); radius = reader.ReadSingle(); width = reader.ReadSingle(); center = reader.ReadRWObject <BXDVector3>(); forwardAsympSlip = reader.ReadSingle(); forwardAsympValue = reader.ReadSingle(); forwardExtremeSlip = reader.ReadSingle(); forwardExtremeValue = reader.ReadSingle(); sideAsympSlip = reader.ReadSingle(); sideAsympValue = reader.ReadSingle(); sideExtremeSlip = reader.ReadSingle(); sideExtremeValue = reader.ReadSingle(); isDriveWheel = reader.ReadBoolean(); }
public Enigma(WheelType[] wheelTypes, ReflectorType reflectorType, IList<Tuple<char,char>> plugboardSettings = null) { Reflector = Reflector.CreateReflector(reflectorType); Wheels = new Wheel[wheelTypes.Length]; ConfigureWheels(wheelTypes); RightWheel = Wheels[Wheels.Length - 1]; var tempDict = new Dictionary<char, char>(); if (plugboardSettings != null) { ValidatePlugboardSettings(plugboardSettings); foreach (var tuple in plugboardSettings) { tempDict.Add(tuple.Item1, tuple.Item2); tempDict.Add(tuple.Item2, tuple.Item1); } } PlugboardDictionary = new ReadOnlyDictionary<char, char>(tempDict); }
private void SetPosition(WheelType type) { switch (type) { case WheelType.Left: { this._image.XPosition = 64; } break; case WheelType.Center: { this._image.XPosition = 102; } break; case WheelType.Right: { this._image.XPosition = 140; } break; } }
public static Wheel CreateWheel(WheelType wheelType) { if (wheelType == WheelType.I) { return(new Wheel_I()); } if (wheelType == WheelType.II) { return(new Wheel_II()); } if (wheelType == WheelType.III) { return(new Wheel_III()); } if (wheelType == WheelType.IV) { return(new Wheel_IV()); } if (wheelType == WheelType.V) { return(new Wheel_V()); } if (wheelType == WheelType.VI) { return(new Wheel_VI()); } if (wheelType == WheelType.VII) { return(new Wheel_VII()); } if (wheelType == WheelType.VIII) { return(new Wheel_VIII()); } if (wheelType == WheelType.Beta) { return(new Wheel_Beta()); } if (wheelType == WheelType.Gamma) { return(new Wheel_Gamma()); } throw new ArgumentException(); }
private string GetAssetName(WheelType type) { switch (type) { case WheelType.Left: { return "Assets/SlotMachine/LeftWheelRoll.zip"; }; case WheelType.Center: { return "Assets/SlotMachine/CenterWheelRoll.zip"; }; case WheelType.Right: { return "Assets/SlotMachine/RightWheelRoll.zip"; }; } return string.Empty; }
private Vector GetPosition(WheelType type) { switch (type) { case WheelType.Left: { return new Vector(64, 34, 0); }; case WheelType.Center: { return new Vector(102, 34, 0); }; case WheelType.Right: { return new Vector(140, 34, 0); }; } return new Vector(0, 0, 0); }
public Bombe(IEnumerable<MapEntry> mapping, char input, char entry, WheelType[] wheelTypes, ReflectorType reflectorType, bool enableDiagonalBoard) { this.input = input; this.entry = entry; Buses = new Dictionary<char, Bus>(); for (char c = 'A'; c <= 'Z'; c++) Buses.Add(c, new Bus(c)); if (enableDiagonalBoard) { diagonalBoard = new DiagonalBoard(Buses); //yes, hackey.... } Enigmas = new List<BombeEnigma>(); foreach (var map in mapping) { var bombeEnigma = new BombeEnigma(wheelTypes, reflectorType, map.StepsAheadOfKey, Buses[map.LeftChar], Buses[map.RightChar]); Enigmas.Add(bombeEnigma); } CurrentKeys = new char[wheelTypes.Length]; }
public static WheelType GetVariantWheelType(WheelType wheelType) { switch (wheelType) { case WheelType.Stock: return(WheelType.StockInvisible); case WheelType.StockInvisible: return(WheelType.Stock); case WheelType.Red: return(WheelType.RedInvisible); case WheelType.RedInvisible: return(WheelType.Red); default: return(WheelType.Stock); } }
private void ReloadWheelModels() { if (_roadWheel == TimeCircuits.Delorean.Mods.Wheel) { return; } leftWheelProps.ForEach(x => x?.DeleteProp()); leftWheelProps.Clear(); rightWheelProps.ForEach(x => x?.DeleteProp()); rightWheelProps.Clear(); _roadWheel = TimeCircuits.Delorean.IsStockWheel ? WheelType.Stock : WheelType.Red; Model modelWheel = _roadWheel == WheelType.Stock ? ModelHandler.WheelProp : ModelHandler.RedWheelProp; Model modelWheelRear = _roadWheel == WheelType.Stock ? ModelHandler.RearWheelProp : ModelHandler.RedWheelProp; foreach (var wheel in Utils.GetWheelPositions(vehicle)) { string wheelName = wheel.Key; Vector3 offset = wheel.Value; bool leftWheel = (wheelName.Contains("lf") || wheelName.Contains("lr")); bool frontWheel = (wheelName.Contains("lf") || wheelName.Contains("rf")); Model wheelModel = !frontWheel ? modelWheelRear : modelWheel; ModelHandler.RequestModel(wheelModel); AnimateProp wheelAnimateProp = new AnimateProp(vehicle, wheelModel, offset, Vector3.Zero); if (leftWheel) { leftWheelProps.Add(wheelAnimateProp); } else { rightWheelProps.Add(wheelAnimateProp); } } }
private string GetFileName(WheelType type) { switch (type) { case WheelType.Left: { return("wheel_a_"); }; case WheelType.Center: { return("wheel_b_"); }; case WheelType.Right: { return("wheel_c_"); }; } return(string.Empty); }
private Vector GetPosition(WheelType type) { switch (type) { case WheelType.Left: { return(new Vector(64, 34, 0)); }; case WheelType.Center: { return(new Vector(102, 34, 0)); }; case WheelType.Right: { return(new Vector(140, 34, 0)); }; } return(new Vector(0, 0, 0)); }
public DeloreanModsCopy(DeloreanMods deloreanMods) { DeloreanType = deloreanMods.DeloreanType; SuspensionsType = deloreanMods.SuspensionsType; Wheel = deloreanMods.Wheel; Exterior = deloreanMods.Exterior; Interior = deloreanMods.Interior; OffCoils = deloreanMods.OffCoils; GlowingEmitter = deloreanMods.GlowingEmitter; GlowingReactor = deloreanMods.GlowingReactor; DamagedBumper = deloreanMods.DamagedBumper; SteeringWheelsButtons = deloreanMods.SteeringWheelsButtons; HoverUnderbody = deloreanMods.HoverUnderbody; Vents = deloreanMods.Vents; Seats = deloreanMods.Seats; Reactor = deloreanMods.Reactor; Exhaust = deloreanMods.Exhaust; Hoodbox = deloreanMods.Hoodbox; Hook = deloreanMods.Hook; Plate = deloreanMods.Plate; }
private string GetAssetName(WheelType type) { switch (type) { case WheelType.Left: { return("Assets/SlotMachine/LeftWheelRoll.zip"); }; case WheelType.Center: { return("Assets/SlotMachine/CenterWheelRoll.zip"); }; case WheelType.Right: { return("Assets/SlotMachine/RightWheelRoll.zip"); }; } return(string.Empty); }
protected Wheel(WheelType wheelType, int[] map, int[] notches) { this.WheelType = wheelType; EnableNotch = true; if (map.Length != 26) { throw new ArgumentException(); } Mapping = map; Notches = notches; ReverseMapping = new int[26]; for (int i = 0; i < map.Length; i++) { var reverseNum = i + map[i]; if (reverseNum < 0 || reverseNum > 25) { throw new InvalidOperationException(); } ReverseMapping[reverseNum] = -map[i]; } }
/// <summary> /// Adds a wheel to the BRaycastVehicle from the given information. /// </summary> /// <param name="connectionPoint"></param> /// <param name="axle"></param> /// <param name="suspensionRestLength"></param> /// <param name="radius"></param> /// <returns></returns> public int AddWheel(WheelType wheelType, BulletSharp.Math.Vector3 connectionPoint, BulletSharp.Math.Vector3 axle, float suspensionRestLength, float radius) { switch (wheelType) { case WheelType.MECANUM: RaycastRobot.SlidingFriction = 0.1f; axle = (Quaternion.AngleAxis((connectionPoint.X > 0 && connectionPoint.Z > 0) || (connectionPoint.X < 0 && connectionPoint.Z < 0) ? -45 : 45, Vector3.up) * axle.ToUnity()).ToBullet(); break; case WheelType.OMNI: RaycastRobot.SlidingFriction = 0.1f; break; } WheelInfo w = RaycastRobot.AddWheel(connectionPoint, -BulletSharp.Math.Vector3.UnitY, axle, suspensionRestLength, radius, vehicleTuning, false); w.RollInfluence = 0.25f; w.Brake = (RollingFriction / radius) * RaycastRobot.OverrideMass * BRaycastWheel.MassTorqueScalar; return(RaycastRobot.NumWheels - 1); }
public IRCCarBuilder AddWheelType(WheelType wheelType) { _wheelType = wheelType; return(this); }
public void CreateJoint(int numWheels, bool mixAndMatch, float wheelFriction = 1f, float lateralFriction = 1f) { if (joint != null || GetSkeletalJoint() == null) { return; } switch (GetSkeletalJoint().GetJointType()) { case SkeletalJointType.ROTATIONAL: if (this.HasDriverMeta <WheelDriverMeta>() && this.GetDriverMeta <WheelDriverMeta>().type != WheelType.NOT_A_WHEEL) { RigidNode parent = (RigidNode)GetParent(); if (parent.MainObject.GetComponent <BRaycastRobot>() == null) { BRaycastRobot robot = parent.MainObject.AddComponent <BRaycastRobot>(); robot.NumWheels = numWheels; } WheelType wheelType = this.GetDriverMeta <WheelDriverMeta>().type; BRaycastWheel wheel = MainObject.AddComponent <BRaycastWheel>(); wheel.CreateWheel(this); if (mixAndMatch) { wheel.Friction = wheelFriction; wheel.SlidingFriction = lateralFriction; } MainObject.transform.parent = parent.MainObject.transform; } else { RotationalJoint_Base rNode = (RotationalJoint_Base)GetSkeletalJoint(); rNode.basePoint.x *= -1; BHingedConstraintEx hc = (BHingedConstraintEx)(joint = ConfigJoint <BHingedConstraintEx>(rNode.basePoint.AsV3() - ComOffset, rNode.axis.AsV3(), AxisType.X)); Vector3 rAxis = rNode.axis.AsV3().normalized; rAxis.x *= -1f; hc.axisInA = rAxis; hc.axisInB = rAxis; if (hc.setLimit = rNode.hasAngularLimit) { hc.lowLimitAngleRadians = rNode.currentAngularPosition - rNode.angularLimitHigh; hc.highLimitAngleRadians = rNode.currentAngularPosition - rNode.angularLimitLow; } hc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; } break; case SkeletalJointType.CYLINDRICAL: CylindricalJoint_Base cNode = (CylindricalJoint_Base)GetSkeletalJoint(); B6DOFConstraint bc = (B6DOFConstraint)(joint = ConfigJoint <B6DOFConstraint>(cNode.basePoint.AsV3() - ComOffset, cNode.axis.AsV3(), AxisType.X)); bc.linearLimitLower = new Vector3(cNode.linearLimitStart * 0.01f, 0f, 0f); bc.linearLimitUpper = new Vector3(cNode.linearLimitEnd * 0.01f, 0f, 0f); bc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; break; case SkeletalJointType.LINEAR: LinearJoint_Base lNode = (LinearJoint_Base)GetSkeletalJoint(); lNode.basePoint.x *= -1; Vector3 lAxis = lNode.axis.AsV3().normalized; // TODO: Figure out how to make a vertical slider? BSliderConstraint sc = (BSliderConstraint)(joint = ConfigJoint <BSliderConstraint>(lNode.basePoint.AsV3() - ComOffset, lNode.axis.AsV3(), AxisType.X)); if (lAxis.x < 0) { lAxis.x *= -1f; } if (lAxis.y < 0) { lAxis.y *= -1f; } if (lAxis.z < 0) { lAxis.z *= -1f; } sc.localConstraintAxisX = lAxis; sc.localConstraintAxisY = new Vector3(lAxis.y, lAxis.z, lAxis.x); sc.lowerLinearLimit = lNode.linearLimitLow * 0.01f; sc.upperLinearLimit = lNode.linearLimitHigh * 0.01f; sc.lowerAngularLimitRadians = 0f; sc.upperAngularLimitRadians = 0f; sc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; bool b = this.HasDriverMeta <ElevatorDriverMeta>(); if (GetSkeletalJoint().cDriver != null) { if (GetSkeletalJoint().cDriver.GetDriveType().IsElevator()) { MainObject.GetComponent <BRigidBody>().mass *= 2f; } } break; } }
public void CreateJoint(RobotBase robotBase, float wheelFriction = 1f, float lateralFriction = 1f) { if (joint != null || GetSkeletalJoint() == null) { return; } switch (GetSkeletalJoint().GetJointType()) { case SkeletalJointType.ROTATIONAL: if (this.HasDriverMeta <WheelDriverMeta>() && this.GetDriverMeta <WheelDriverMeta>().type != WheelType.NOT_A_WHEEL) { RigidNode parent = (RigidNode)GetParent(); if (parent.MainObject.GetComponent <BRaycastRobot>() == null) { parent.MainObject.AddComponent <BRaycastRobot>().RootNode = RootNode; } WheelType wheelType = this.GetDriverMeta <WheelDriverMeta>().type; BRaycastWheel wheel = MainObject.AddComponent <BRaycastWheel>(); wheel.CreateWheel(this); if (robotBase is MaMRobot) { wheel.Friction = wheelFriction; wheel.SlidingFriction = lateralFriction; } MainObject.transform.parent = parent.MainObject.transform; } else { RotationalJoint_Base rNode = (RotationalJoint_Base)GetSkeletalJoint(); BHingedConstraintEx hc = (BHingedConstraintEx)(joint = ConfigJoint <BHingedConstraintEx>(rNode.basePoint.AsV3() - ComOffset, rNode.axis.AsV3(), AxisType.X)); Vector3 rAxis = rNode.axis.AsV3().normalized; hc.axisInA = rAxis; hc.axisInB = rAxis; if (hc.setLimit = rNode.hasAngularLimit) { hc.lowLimitAngleRadians = rNode.currentAngularPosition - rNode.angularLimitHigh; hc.highLimitAngleRadians = rNode.currentAngularPosition - rNode.angularLimitLow; } hc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; } break; case SkeletalJointType.CYLINDRICAL: CylindricalJoint_Base cNode = (CylindricalJoint_Base)GetSkeletalJoint(); Vector3 cAxis = cNode.axis.AsV3().normalized; B6DOFConstraint bc = (B6DOFConstraint)(joint = ConfigJoint <B6DOFConstraint>(cNode.basePoint.AsV3() - ComOffset, cAxis, AxisType.X)); bc.localConstraintAxisX = cAxis; bc.localConstraintAxisY = new Vector3(cAxis.y, cAxis.z, cAxis.x); bc.linearLimitLower = new Vector3((cNode.linearLimitStart - cNode.currentLinearPosition) * 0.01f, 0f, 0f); bc.linearLimitUpper = new Vector3((cNode.linearLimitEnd - cNode.currentLinearPosition) * 0.01f, 0f, 0f); // TODO: Implement angular cylinder limits bc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; break; case SkeletalJointType.LINEAR: LinearJoint_Base lNode = (LinearJoint_Base)GetSkeletalJoint(); Vector3 lAxis = lNode.axis.AsV3().normalized; BSliderConstraint sc = (BSliderConstraint)(joint = ConfigJoint <BSliderConstraint>(lNode.basePoint.AsV3() - ComOffset, lAxis, AxisType.X)); sc.localConstraintAxisX = lAxis; sc.localConstraintAxisY = new Vector3(lAxis.y, lAxis.z, lAxis.x); sc.lowerLinearLimit = (lNode.linearLimitLow - lNode.currentLinearPosition) * 0.01f; sc.upperLinearLimit = (lNode.linearLimitHigh - lNode.currentLinearPosition) * 0.01f; sc.lowerAngularLimitRadians = 0f; sc.upperAngularLimitRadians = 0f; sc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; bool b = this.HasDriverMeta <ElevatorDriverMeta>(); if (GetSkeletalJoint().cDriver != null) { if (GetSkeletalJoint().cDriver.GetDriveType().IsElevator()) { MainObject.GetComponent <BRigidBody>().mass *= 2f; } } break; } }
private void RestoreCurrentWheelFromFile() { string wheel = string.Empty; string pos = string.Empty; string[] parts; char[] spaces = { ' ', '\t' }; WheelType wheelType = WheelType.WheelUnknown; short p = -1; if (!System.IO.File.Exists(_savedFile)) { return; } using (var sr = new System.IO.StreamReader(_savedFile)) { string line; while ((line = sr.ReadLine()) != null) { if (line.StartsWith("Wheel: ")) { parts = line.Split(':'); wheel = parts[1].TrimStart(spaces); } else if (line.StartsWith("Position:")) { parts = line.Split(':'); pos = parts[1].TrimStart(spaces); } } } try { Enum.TryParse <WheelType>(wheel, out wheelType); } catch (FormatException) { } try { p = Convert.ToInt16(pos); } catch (FormatException) { } switch (wheelType) { case WheelType.WheelUnknown: currentWheel = wheelUnknown; break; case WheelType.Wheel4: currentWheel = wheel4; break; case WheelType.Wheel8: currentWheel = wheel8; break; } currentWheel._position = p; #region debug debugger.WriteLine(Debugger.DebugLevel.DebugLogic, "WiseFilterWheel:RestoreCurrentFromFile: wheel = {0}, position = {1}", currentWheel._name, currentWheel._position); #endregion }
private void ConfigureWheels(WheelType[] wheelTypes) { for (int i = 0; i < wheelTypes.Length; i++) { Wheels[i] = Wheel.CreateWheel(wheelTypes[i]); if (i == 0) { Reflector.SignalOut = Wheels[0].SignalLeftSide; Wheels[0].SignalOutLeft = Reflector.Signal; } else { Wheels[i - 1].SignalOutRight = Wheels[i].SignalLeftSide; Wheels[i].SignalOutLeft = Wheels[i - 1].SignalRightSide; } } }
public static Wheel CreateWheel(WheelType wheelType) { if (wheelType == WheelType.I) return new Wheel_I(); if (wheelType == WheelType.II) return new Wheel_II(); if (wheelType == WheelType.III) return new Wheel_III(); if (wheelType == WheelType.IV) return new Wheel_IV(); if (wheelType == WheelType.V) return new Wheel_V(); if (wheelType == WheelType.VI) return new Wheel_VI(); if (wheelType == WheelType.VII) return new Wheel_VII(); if (wheelType == WheelType.VIII) return new Wheel_VIII(); if (wheelType == WheelType.Beta) return new Wheel_Beta(); if (wheelType == WheelType.Gamma) return new Wheel_Gamma(); throw new ArgumentException(); }
// Adds the wheel types definitions to each one of the wheels private WheelDistribution(WheelType frontWheel, WheelType rearWheel) { wheelType[0] = wheelType[1] = frontWheel; wheelType[2] = wheelType[3] = rearWheel; }
public void CreateJoint() { if (joint != null || GetSkeletalJoint() == null) { return; } switch (GetSkeletalJoint().GetJointType()) { case SkeletalJointType.ROTATIONAL: WheelType wheelType = WheelType.NOT_A_WHEEL; if (this.HasDriverMeta <WheelDriverMeta>()) { OrientWheelNormals(); wheelType = this.GetDriverMeta <WheelDriverMeta>().type; } RotationalJoint_Base rNode = (RotationalJoint_Base)GetSkeletalJoint(); BHingedConstraintEx hc = (BHingedConstraintEx)(joint = ConfigJoint <BHingedConstraintEx>(rNode.basePoint.AsV3() - ComOffset, rNode.axis.AsV3(), AxisType.X)); Vector3 rAxis = rNode.axis.AsV3().normalized; hc.axisInA = rAxis; hc.axisInB = rAxis; if (hc.setLimit = rNode.hasAngularLimit) { hc.lowLimitAngleRadians = rNode.currentAngularPosition - rNode.angularLimitHigh; hc.highLimitAngleRadians = rNode.currentAngularPosition - rNode.angularLimitLow; } hc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; break; case SkeletalJointType.CYLINDRICAL: CylindricalJoint_Base cNode = (CylindricalJoint_Base)GetSkeletalJoint(); B6DOFConstraint bc = (B6DOFConstraint)(joint = ConfigJoint <B6DOFConstraint>(cNode.basePoint.AsV3() - ComOffset, cNode.axis.AsV3(), AxisType.X)); bc.linearLimitLower = new Vector3(cNode.linearLimitStart * 0.01f, 0f, 0f); bc.linearLimitUpper = new Vector3(cNode.linearLimitEnd * 0.01f, 0f, 0f); bc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; break; case SkeletalJointType.LINEAR: LinearJoint_Base lNode = (LinearJoint_Base)GetSkeletalJoint(); Vector3 lAxis = lNode.axis.AsV3().normalized; // TODO: Figure out how to make a vertical slider? BSliderConstraint sc = (BSliderConstraint)(joint = ConfigJoint <BSliderConstraint>(lNode.basePoint.AsV3() - ComOffset, lNode.axis.AsV3(), AxisType.X)); if (lAxis.x < 0) { lAxis.x *= -1f; } if (lAxis.y < 0) { lAxis.y *= -1f; } if (lAxis.z < 0) { lAxis.z *= -1f; } sc.localConstraintAxisX = lAxis; sc.localConstraintAxisY = new Vector3(lAxis.y, lAxis.z, lAxis.x); sc.lowerLinearLimit = lNode.linearLimitLow * 0.01f; sc.upperLinearLimit = lNode.linearLimitHigh * 0.01f; sc.lowerAngularLimitRadians = 0f; sc.upperAngularLimitRadians = 0f; sc.constraintType = BTypedConstraint.ConstraintType.constrainToAnotherBody; bool b = this.HasDriverMeta <ElevatorDriverMeta>(); if (GetSkeletalJoint().cDriver != null) { if (GetSkeletalJoint().cDriver.GetDriveType().IsElevator()) { MainObject.GetComponent <BRigidBody>().mass *= 2f; } } break; } }
MapConfiguration GetMapFromData() { if (rotor1.SelectedIndex == -1 || rotor2.SelectedIndex == -1 || rotor3.SelectedIndex == -1 || reflectorType.SelectedIndex == -1 || currentEntry.SelectedIndex == -1 || inputLetter.SelectedIndex == -1) { MessageBox.Show("Fill all the gaps!"); return(null); } if (MapEntryList == null) { MessageBox.Show("Fill Map Entries!"); return(null); } string[] wheelStr = { rotor1.Text, rotor2.Text, rotor3.Text }; WheelType[] wheels = new WheelType[3]; for (int i = 0; i < wheels.Length; i++) { switch (wheelStr[i]) { case ("I"): wheels[i] = WheelType.I; break; case ("II"): wheels[i] = WheelType.II; break; case ("III"): wheels[i] = WheelType.III; break; case ("IV"): wheels[i] = WheelType.IV; break; case ("V"): wheels[i] = WheelType.V; break; case ("VI"): wheels[i] = WheelType.VI; break; case ("VII"): wheels[i] = WheelType.VII; break; case ("VIII"): wheels[i] = WheelType.VIII; break; case ("Beta"): wheels[i] = WheelType.Beta; break; case ("Gamma"): wheels[i] = WheelType.Gamma; break; } } ReflectorType refType = ReflectorType.A; switch (reflectorType.Text) { case ("A"): refType = ReflectorType.A; break; case ("B"): refType = ReflectorType.B; break; case ("C"): refType = ReflectorType.C; break; case ("B_Thin"): refType = ReflectorType.B_Thin; break; case ("C_Thin"): refType = ReflectorType.C_Thin; break; } bool enableDB = enableDiagonalBoard.Checked; char entry = currentEntry.Text[0]; char input = inputLetter.Text[0]; MapEntry[] mapEntries = entries.ToArray(); return(new MapConfiguration(wheels, refType, enableDB, entry, input, mapEntries)); }
private string GetFileName(WheelType type) { switch (type) { case WheelType.Left: { return "wheel_a_"; }; case WheelType.Center: { return "wheel_b_"; }; case WheelType.Right: { return "wheel_c_"; }; } return string.Empty; }
private List <CarPart> ConvertLinesToCarParts(List <string> lines) { var carParts = new List <CarPart>(); foreach (var line in lines) { var quantity = line.Split(' ')[0]; var type = line.Split(' ')[1]; var part = line.Split(' ')[2]; int nr; bool isChassis = false; bool isEngine = false; bool isPaint = false; bool isWheel = false; var isInt = int.TryParse(quantity, out nr); if (!isInt) { throw new Exception($"Invalid car part {line}"); } if (part.Contains(Wheel.ToString())) { WheelType wheelType = WheelType.SUMMER; isWheel = Enum.TryParse <WheelType>(type.ToUpper(), out wheelType); if (isWheel) { carParts.Add(new Wheel() { WheelType = wheelType }); } continue; } if (part.Contains(Engine.ToString())) { EngineType engineType = EngineType.DIESEL; isEngine = Enum.TryParse <EngineType>(type.ToUpper(), out engineType); if (isEngine) { carParts.Add(new Engine() { EngineType = engineType }); } continue; } if (part.Contains(Chassis.ToString())) { ChassisType chassisType = ChassisType.TITANIUM; isChassis = Enum.TryParse <ChassisType>(type.ToUpper(), out chassisType); if (isChassis) { carParts.Add(new Chassis() { ChassisType = chassisType }); } continue; } if (part.Contains(Paint.ToString())) { PaintType paintType = PaintType.BLACK; isPaint = Enum.TryParse <PaintType>(type.ToUpper(), out paintType); if (isPaint) { carParts.Add(new Paint() { PaintType = paintType }); } continue; } if (!isChassis && !isEngine && !isPaint && !isWheel) { throw new Exception($"Invalid car part {line}"); } } return(carParts); }
ICarBuildContext ICarBuildContext.WithWheels(WheelType wheelType) { Wheel = wheelType; return this; }