public static bool UpdateReplacement(SatelliteSnapshotController __instance) { if (!OWInput.IsInputMode(InputMode.SatelliteCam)) { return(false); } if (OWInput.IsNewlyPressed(InputLibrary.toolActionPrimary)) { new SatelliteProjectorSnapshotMessage(true).Send(); __instance._satelliteCamera.transform.localEulerAngles = __instance._initCamLocalRot; __instance.RenderSnapshot(); return(false); } if (__instance._allowRearview && OWInput.IsNewlyPressed(InputLibrary.toolActionSecondary)) { new SatelliteProjectorSnapshotMessage(false).Send(); __instance._satelliteCamera.transform.localEulerAngles = __instance._initCamLocalRot + new Vector3(0f, 180f, 0f); __instance.RenderSnapshot(); return(false); } if (OWInput.IsNewlyPressed(InputLibrary.cancel)) { __instance.TurnOffProjector(); } return(false); }
public static bool Update(QuantumInstrument __instance) { if (__instance._gatherWithScope && !__instance._waitToFlickerOut) { __instance._scopeGatherPrompt.SetVisibility(false); if (Locator.GetToolModeSwapper().GetSignalScope().InZoomMode() && Vector3.Angle(__instance.transform.position - Locator.GetPlayerCamera().transform.position, Locator.GetPlayerCamera().transform.forward) < 1f) { __instance._scopeGatherPrompt.SetVisibility(true); if (OWInput.IsNewlyPressed(InputLibrary.interact)) { __instance.Gather(); __instance.GetWorldObject <QSBQuantumInstrument>().SendMessage(new GatherInstrumentMessage()); Locator.GetPromptManager().RemoveScreenPrompt(__instance._scopeGatherPrompt); } } } if (__instance._waitToFlickerOut && Time.time > __instance._flickerOutTime) { __instance.FinishGather(); } return(false); }
void Update() { if (OWInput.IsNewlyPressed(InputLibrary.scopeView, InputMode.All) && Locator.GetToolModeSwapper().IsInToolMode(ToolMode.SignalScope, ToolGroup.Suit)) { _lens.gameObject.SetActive(!_lens.gameObject.activeSelf); } }
private void UpdateSignalscipeZoom() { if (OWInput.IsNewlyPressed(InputLibrary.scopeView, InputMode.All) && ToolHelper.Swapper.IsInToolMode(ToolMode.SignalScope, ToolGroup.Suit)) { _lens.gameObject.SetActive(!_lens.gameObject.activeSelf); _owLensCamera.SetEnabled(_lens.gameObject.activeSelf); } }
void Update() { var isInShip = _cockpitController.IsPlayerAtFlightConsole(); if (isInShip && !_canInteractWithTools) { SetEnabled(true); } else if (!isInShip && _canInteractWithTools) { SetEnabled(false); } if (_referenceFrameTracker.isActiveAndEnabled && Common.IsUsingAnyTool()) { _referenceFrameTracker.enabled = false; } else if (!_referenceFrameTracker.isActiveAndEnabled && !Common.IsUsingAnyTool()) { _referenceFrameTracker.enabled = true; } if (_referenceFrameTracker.GetReferenceFrame() == null && _referenceFrameTracker.GetPossibleReferenceFrame() == null) { return; } if (OWInput.IsNewlyPressed(InputLibrary.interact)) { _pressedInteract = true; } if (OWInput.IsNewlyHeld(InputLibrary.interact)) { ControllerInput.SimulateInput(XboxAxis.dPadY, 1); _wasHoldingInteract = true; } if (OWInput.IsNewlyReleased(InputLibrary.interact)) { if (_wasHoldingInteract) { ControllerInput.SimulateInput(XboxAxis.dPadY, 0); _wasHoldingInteract = false; } else if (_pressedInteract && !IsFocused(_probe) && !IsFocused(_signalscope) && !IsFocused(_landingCam)) { ControllerInput.SimulateInput(XboxButton.LeftStickClick); } _pressedInteract = false; } }
private void Update() { if (_currentDialogueBox != null && OWInput.GetInputMode() == InputMode.Dialogue) { if (OWInput.IsNewlyPressed(InputLibrary.interact) || OWInput.IsNewlyPressed(InputLibrary.cancel) || OWInput.IsNewlyPressed(InputLibrary.enter) || OWInput.IsNewlyPressed(InputLibrary.enter2)) { if (!_currentDialogueBox.AreTextEffectsComplete()) { _currentDialogueBox.FinishAllTextEffects(); return; } if (_currentDialogueBox.TimeCompletelyRevealed() < 0.1f) { return; } var selectedOption = _currentDialogueBox.GetSelectedOption(); if (!InputDialogueOption(selectedOption)) { EndConversation(); return; } } else { if (OWInput.IsNewlyPressed(InputLibrary.down) || OWInput.IsNewlyPressed(InputLibrary.down2)) { _currentDialogueBox.OnDownPressed(); return; } if (OWInput.IsNewlyPressed(InputLibrary.up) || OWInput.IsNewlyPressed(InputLibrary.up2)) { _currentDialogueBox.OnUpPressed(); } } } }
private static bool IsSelectNewlyPressed() { return(OWInput.IsNewlyPressed(InputLibrary.menuConfirm)); }
public static bool RoastingStickController_UpdateMarshmallowInput( float ____extendFraction, Marshmallow ____marshmallow, GameObject ____mallowBodyPrefab, Transform ____stickTransform, Campfire ____campfire, ref string ____promptText, ScreenPrompt ____mallowPrompt, ref bool ____showMallowPrompt, ref bool ____showRemovePrompt) { var changePromptText = false; var showRemovePrompt = false; var text = string.Empty; if (____extendFraction == 0f) { if (____marshmallow.IsEdible()) { text = UITextLibrary.GetString(UITextType.RoastingEatPrompt); changePromptText = true; if (____marshmallow.IsBurned()) { showRemovePrompt = true; if (OWInput.IsNewlyPressed(InputLibrary.cancel, true, InputMode.Roasting)) { ____marshmallow.Remove(); Locator.GetPlayerAudioController().PlayMarshmallowToss(); var spawnedMarshmallow = UnityEngine.Object.Instantiate <GameObject>(____mallowBodyPrefab, ____stickTransform.position, ____stickTransform.rotation); var rigidbody = spawnedMarshmallow.GetComponent <OWRigidbody>(); rigidbody.SetVelocity(____campfire.GetAttachedOWRigidbody(false).GetPointVelocity(____stickTransform.position) + (____stickTransform.forward * 3f)); rigidbody.SetAngularVelocity(____stickTransform.right * 10f); var burntColor = ____marshmallow.GetBurntColor(); spawnedMarshmallow.GetComponentInChildren <MeshRenderer>().material.color = burntColor; QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Toss); } } if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting) && ____marshmallow.IsEdible()) { ____marshmallow.Eat(); } } else if (____marshmallow.GetState() == Marshmallow.MallowState.Burning) { text = UITextLibrary.GetString(UITextType.RoastingExtinguishPrompt); changePromptText = true; if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting)) { ____marshmallow.Extinguish(); QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Extinguish); } } else if (____marshmallow.GetState() == Marshmallow.MallowState.Gone) { text = UITextLibrary.GetString(UITextType.RoastingReplacePrompt); changePromptText = true; if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting)) { ____marshmallow.SpawnMallow(true); } } if (changePromptText && ____promptText != text) { ____promptText = text; ____mallowPrompt.SetText(____promptText); } if (OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.Roasting)) { ____campfire.StopRoasting(); return(false); } } ____showMallowPrompt = changePromptText; ____showRemovePrompt = showRemovePrompt; return(false); }
public static void Prefix(ThrusterModel __instance, ref Vector3 ____translationalInput) { if (!SmoothThrust.container.ContainsKey(__instance)) { SmoothThrust.container.Add(__instance, new SmoothThrust.SmoothCont()); } SmoothThrust.SmoothCont iter = SmoothThrust.container[__instance]; if (OWInput.IsNewlyPressed(InputLibrary.interact)) { iter._prevTranslation = ____translationalInput; iter._buildupVelocity = Vector3.zero; } if (OWInput.IsPressed(InputLibrary.interact, 0.05f)) { iter._prevTranslation.x = Mathf.SmoothDamp(iter._prevTranslation.x, ____translationalInput.x, ref iter._buildupVelocity.x, SmoothThrust._analogSmoothTime); iter._prevTranslation.z = Mathf.SmoothDamp(iter._prevTranslation.z, ____translationalInput.z, ref iter._buildupVelocity.z, SmoothThrust._analogSmoothTime); iter._prevTranslation.y = Mathf.SmoothDamp(iter._prevTranslation.y, ____translationalInput.y, ref iter._buildupVelocity.y, SmoothThrust._analogSmoothTime); ____translationalInput = iter._prevTranslation; } if (SmoothThrust.anglerSafety && (SmoothThrust.ShipNMBody != null || SmoothThrust.PlayerNMBody != null)) { Vector3 myPos; if (__instance is ShipThrusterModel) { myPos = SmoothThrust.ShipNMBody.GetCenterOfMass(); } else { myPos = SmoothThrust.PlayerNMBody.GetCenterOfMass(); } float mindist = Mathf.Infinity; bool triggered = false; foreach (AnglerfishController fish in SmoothThrust.fishes) { if (fish.gameObject.activeSelf) { if (fish.GetAnglerState() == AnglerfishController.AnglerState.Chasing) { triggered = true; } float dist = Vector3.Distance(myPos, fish.transform.position); mindist = Mathf.Min(dist, mindist); } } if (triggered) { mindist = Mathf.Infinity; } SmoothThrust.limiter = Mathf.Infinity; if (__instance is ShipThrusterModel) { if (mindist <= 400.1f) { if (____translationalInput.magnitude * __instance.GetMaxTranslationalThrust() >= mindist / 20f) { ____translationalInput = ____translationalInput.normalized * (mindist / 21f) / __instance.GetMaxTranslationalThrust(); } } } else { if (mindist <= 210f) { if (____translationalInput.magnitude * 100f * __instance.GetMaxTranslationalThrust() >= mindist * 3f) { ____translationalInput = ____translationalInput.normalized * (mindist / 35f) / __instance.GetMaxTranslationalThrust(); } } } } iter._prevTranslation = ____translationalInput; SmoothThrust.container[__instance] = iter; }
public static bool RoastingStickController_UpdateMarshmallowInput( RoastingStickController __instance ) { var changePromptText = false; var showRemovePrompt = false; var text = string.Empty; if (__instance._extendFraction == 0f) { if (__instance._marshmallow.IsEdible()) { text = UITextLibrary.GetString(UITextType.RoastingEatPrompt); changePromptText = true; if (__instance._marshmallow.IsBurned()) { showRemovePrompt = true; if (OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.Roasting)) { InputLibrary.cancel.ConsumeInput(); __instance._marshmallow.Remove(); Locator.GetPlayerAudioController().PlayMarshmallowToss(); var spawnedMarshmallow = Object.Instantiate(__instance._mallowBodyPrefab, __instance._stickTransform.position, __instance._stickTransform.rotation); var rigidbody = spawnedMarshmallow.GetComponent <OWRigidbody>(); rigidbody.SetVelocity(__instance._campfire.GetAttachedOWRigidbody().GetPointVelocity(__instance._stickTransform.position) + __instance._stickTransform.forward * 3f); rigidbody.SetAngularVelocity(__instance._stickTransform.right * 10f); var burntColor = __instance._marshmallow.GetBurntColor(); spawnedMarshmallow.GetComponentInChildren <MeshRenderer>().material.color = burntColor; new MarshmallowEventMessage(MarshmallowMessageType.Toss).Send(); } } if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting) && __instance._marshmallow.IsEdible()) { __instance._marshmallow.Eat(); } } else if (__instance._marshmallow.GetState() == Marshmallow.MallowState.Burning) { text = UITextLibrary.GetString(UITextType.RoastingExtinguishPrompt); changePromptText = true; if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting)) { __instance._marshmallow.Extinguish(); new MarshmallowEventMessage(MarshmallowMessageType.Extinguish).Send(); } } else if (__instance._marshmallow.GetState() == Marshmallow.MallowState.Gone) { text = UITextLibrary.GetString(UITextType.RoastingReplacePrompt); changePromptText = true; if (OWInput.IsNewlyPressed(InputLibrary.interact, InputMode.Roasting)) { __instance._marshmallow.SpawnMallow(true); } } if (changePromptText && __instance._promptText != text) { __instance._promptText = text; __instance._mallowPrompt.SetText(__instance._promptText); } if (OWInput.IsNewlyPressed(InputLibrary.cancel, InputMode.Roasting)) { __instance._campfire.StopRoasting(); return(false); } } __instance._showMallowPrompt = changePromptText; __instance._showRemovePrompt = showRemovePrompt; return(false); }