void SetupThrustTransform(Atom thrustAtom) { CycleForceProducerV2 cf = thrustAtom.GetStorableByID("ForceProducer") as CycleForceProducerV2; cf.SetForceReceiver(containingAtom.name + ":hip"); FreeControllerV3 cfControl = thrustAtom.mainController; FreeControllerV3 headControl = containingAtom.freeControllers.First((controller) => controller.name == "headControl"); FreeControllerV3 hipControl = containingAtom.freeControllers.First((controller) => controller.name == "hipControl"); cfControl.transform.SetPositionAndRotation(hipControl.transform.position, hipControl.transform.rotation); cfControl.transform.LookAt(headControl.transform); cfControl.transform.Rotate(0, 180, 0, Space.Self); cfControl.transform.Rotate(new Vector3(0, 0, 1), 90, Space.Self); cfControl.transform.Rotate(new Vector3(1, 0, 0), -90, Space.Self); cfControl.transform.Rotate(new Vector3(0, 0, 1), 90, Space.Self); cfControl.currentPositionState = FreeControllerV3.PositionState.ParentLink; cfControl.currentRotationState = FreeControllerV3.RotationState.ParentLink; Rigidbody rb = SuperController.singleton.RigidbodyNameToRigidbody(containingAtom.name + ":hipControl"); cfControl.SelectLinkToRigidbody(rb, FreeControllerV3.SelectLinkState.PositionAndRotation); HideController(thrustAtom); cycleForce = cf; }
private List <string> GetTargetCycleForceAtomChoices() { List <string> result = new List <string>(); foreach (var uid in SuperController.singleton.GetAtomUIDs()) { var atom = SuperController.singleton.GetAtomByUid(uid); if (atom.forceProducers.Length > 0) { CycleForceProducerV2 cycleForceProducerV2 = atom.GetComponentInChildren <CycleForceProducerV2>(); if (cycleForceProducerV2 != null) { result.Add(uid); if (cycleForceProducerV2.receiver != null) { if (optimalCycleForce == "" && (cycleForceProducerV2.receiver.name == "hip" || cycleForceProducerV2.receiver.name == "pelvis")) { optimalCycleForce = uid; } } } } } result.Add("None"); return(result); }
public bool HasCycleForce() { createdCycleForceAtom = SuperController.singleton.GetAtomByUid(createCycleForceNamed); if (createdCycleForceAtom != null) { _targetCycleForce = createdCycleForceAtom.GetComponentInChildren <CycleForceProducerV2>(); if (_targetCycleForce != null) { if (_targetCycleForce.on) { return(true); } } } return(false); }
public override void Init() { try { createdCycleForce = false; createCycleForceNamed = cycleForceNamePrefix + containingAtom.name; CreateButton("Create / Refresh EM Cycle Force").button.onClick.AddListener( () => CreateCycleForceIfNeeded()); _targetCycleForceAtomChooser = new JSONStorableStringChooser("cycSourceTargetCycleForceAtom", GetTargetCycleForceAtomChoices(), "", "Target Force Producer", (name) => { _cycleForceAtomController = null; _targetCycleForce = null; if (string.IsNullOrEmpty(name)) { return; } var atom = SuperController.singleton.GetAtomByUid(name); if (atom && atom.forceProducers.Length > 0) { if (atom.freeControllers.Length > 0) { _cycleForceAtomController = atom.freeControllers[0]; } _targetCycleForce = atom.GetComponentInChildren <CycleForceProducerV2>(); } }); RegisterStringChooser(_targetCycleForceAtomChooser); if (string.IsNullOrEmpty(_targetCycleForceAtomChooser.val)) { _targetCycleForceAtomChooser.SetVal(_targetCycleForceAtomChooser.choices[0]); } _chooseCycleForceAtomPopup = CreateScrollablePopup(_targetCycleForceAtomChooser); _chooseCycleForceAtomPopup.popup.onOpenPopupHandlers += () => { _targetCycleForceAtomChooser.choices = GetTargetCycleForceAtomChoices(); }; cycleForceCreatesVagTouch = new JSONStorableBool("Always Moan if Cycle Force On", true); CreateToggle(cycleForceCreatesVagTouch); RegisterBool(cycleForceCreatesVagTouch); cycleForceCreatesVagTouch.storeType = JSONStorableParam.StoreType.Full; cycleForceRequiresVagTouch = new JSONStorableBool("Cycle Force Requires Vag Touch", false); CreateToggle(cycleForceRequiresVagTouch); RegisterBool(cycleForceRequiresVagTouch); cycleForceRequiresVagTouch.storeType = JSONStorableParam.StoreType.Full; explanationString = new JSONStorableString("Arousal: 0%", ""); UIDynamicTextField dtext = CreateTextField(explanationString); cycleForceQuickness = new JSONStorableBool("Force Quickness Linked to Arousal", true); CreateToggle(cycleForceQuickness); RegisterBool(cycleForceQuickness); cycleForceQuickness.storeType = JSONStorableParam.StoreType.Full; float forceQuicknessDefault = 0.35f; if (IS_AUTOMATE_VERSION.IS_AUTOMATE) { forceQuicknessDefault = 1.5f; } cycleForceQuicknessMin = new JSONStorableFloat("Force Quickness Min", forceQuicknessDefault, 0f, 10f, false); RegisterFloat(cycleForceQuicknessMin); cycleForceQuicknessMin.storeType = JSONStorableParam.StoreType.Full; CreateSlider(cycleForceQuicknessMin); cycleForceQuicknessMax = new JSONStorableFloat("Force Quickness Max", 5f, 0f, 10f, false); RegisterFloat(cycleForceQuicknessMax); cycleForceQuicknessMax.storeType = JSONStorableParam.StoreType.Full; CreateSlider(cycleForceQuicknessMax); cycleForcePeriod = new JSONStorableBool("Force Period Linked to Arousal", true); CreateToggle(cycleForcePeriod, true); RegisterBool(cycleForcePeriod); cycleForcePeriod.storeType = JSONStorableParam.StoreType.Full; float cycleForceDefault = 6.0f; if (IS_AUTOMATE_VERSION.IS_AUTOMATE) { cycleForceDefault = 1.5f; } cycleForcePeriodMin = new JSONStorableFloat("Force Period Min", cycleForceDefault, 0.1f, 10f, false); RegisterFloat(cycleForcePeriodMin); cycleForcePeriodMin.storeType = JSONStorableParam.StoreType.Full; CreateSlider(cycleForcePeriodMin, true); cycleForcePeriodMax = new JSONStorableFloat("Force Period Max", 0.5f, 0.1f, 10f, false); RegisterFloat(cycleForcePeriodMax); cycleForcePeriodMax.storeType = JSONStorableParam.StoreType.Full; CreateSlider(cycleForcePeriodMax, true); cycleForceFactor = new JSONStorableBool("Force Factor Linked to Arousal", true); CreateToggle(cycleForceFactor, true); RegisterBool(cycleForceFactor); cycleForceFactor.storeType = JSONStorableParam.StoreType.Full; float forceFactorDefault = 30.0f; if (IS_AUTOMATE_VERSION.IS_AUTOMATE) { forceFactorDefault = 200.0f; } cycleForceFactorMin = new JSONStorableFloat("Force Factor Min", forceFactorDefault, 0f, 500f, false); RegisterFloat(cycleForceFactorMin); cycleForceFactorMin.storeType = JSONStorableParam.StoreType.Full; CreateSlider(cycleForceFactorMin, true); cycleForceFactorMax = new JSONStorableFloat("Force Factor Max", 400f, 0f, 500f, false); RegisterFloat(cycleForceFactorMax); cycleForceFactorMax.storeType = JSONStorableParam.StoreType.Full; CreateSlider(cycleForceFactorMax, true); cycleForceRatio = new JSONStorableBool("Force Ratio Linked to Arousal", true); CreateToggle(cycleForceRatio, true); RegisterBool(cycleForceRatio); cycleForceRatio.storeType = JSONStorableParam.StoreType.Full; cycleForceRatioMin = new JSONStorableFloat("Force Ratio Min", 0.5f, 0f, 1.0f, false); RegisterFloat(cycleForceRatioMin); cycleForceRatioMin.storeType = JSONStorableParam.StoreType.Full; CreateSlider(cycleForceRatioMin, true); cycleForceRatioMax = new JSONStorableFloat("Force Ratio Max", 0.35f, 0f, 1.0f, false); RegisterFloat(cycleForceRatioMax); cycleForceRatioMax.storeType = JSONStorableParam.StoreType.Full; CreateSlider(cycleForceRatioMax, true); } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } }