예제 #1
0
 private void Update()
 {
     if (_inputCommand != null && _button != null && OWInput.IsPressed(_inputCommand, InputMode.Menu))
     {
         _button.onClick.Invoke();
     }
 }
예제 #2
0
 private void HandleInput()
 {
     if (ModHelper.Input.IsNewlyPressedExact(_crouchCombo))
     {
         _crouchStartTime = Time.realtimeSinceStartup;
     }
     else if (ModHelper.Input.WasNewlyReleased(_crouchCombo) &&
              !OWInput.IsPressed(InputLibrary.jump))
     {
         _crouchStartTime = null;
         _playerCharacterController.SetValue("_jumpChargeTime", 0);
     }
     else if (OWInput.IsNewlyReleased(InputLibrary.jump))
     {
         _crouchStartTime = null;
     }
 }
예제 #3
0
        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;
        }