public void Update() { if (ExtraSettingsAPI_Loaded && camera != null) { if (persistence.zoomMinimapIn != null && MyInput.GetButton(persistence.zoomMinimapIn)) { ZoomMinimapIn(); } if (persistence.zoomMinimapOut != null && MyInput.GetButton(persistence.zoomMinimapOut)) { ZoomMinimapOut(); } if (persistence.minimapDrag != null && MyInput.GetButtonDown(persistence.minimapDrag)) { InitMinimapDrag(true); } if (persistence.minimapDrag != null && MyInput.GetButton(persistence.minimapDrag)) { OnMinimapDrag(); } if (persistence.minimapDrag != null && MyInput.GetButtonUp(persistence.minimapDrag)) { InitMinimapDrag(false); } if (persistence.caveMode && camera != null) { var playerY = camera.transform.parent.position.y; camera.nearClipPlane = 300 - (playerY + CAVE_MODE_CLIP_TOP); camera.farClipPlane = 300 + (-playerY + CAVE_MODE_CLIP_BOTTOM); } } }
void CalculateMoveDirection() { MoveDirection = new Vector3(0.0f, MoveDirection.y, 0.0f); // Walk. Vector3 dir = new Vector3(MyInput.GetAxis("Horizontal"), 0.0f, MyInput.GetAxis("Vertical")); dir = m_target.transform.TransformDirection(dir); dir.y = 0.0f; if (MyInput.GetButton("Sprint")) { dir *= m_runSpeed; } else { dir *= m_walkSpeed; } MoveDirection += dir; // Jump. if (m_target.isGrounded && MyInput.GetButtonDown("Jump")) { ChangeState(new FPSCharacterStateJump()); } // Character controller don't have gravity support, so apply it here. MoveDirection = new Vector3( MoveDirection.x, MoveDirection.y - m_jumpSpeed * Time.deltaTime, MoveDirection.z ); }
static void Postfix(PersonController __instance, ref Network_Player ___playerNetwork, ref Vector3 ___moveDirection) { if (sprintByDefault && !__instance.crouching && !isCrouching) { __instance.normalSpeed = defaultSprintSpeed; __instance.sprintSpeed = defaultNormalSpeed; } else { __instance.normalSpeed = defaultNormalSpeed; __instance.sprintSpeed = defaultSprintSpeed; } if (crouchIsToggle) { if (MyInput.GetButtonUp("Crouch")) { isCrouching = !isCrouching; } __instance.crouching = isCrouching; ___playerNetwork.Animator.anim.SetBool("Crouching", isCrouching); if (!MyInput.GetButton("Crouch") && isCrouching) { float speed = MyInput.GetButton("Sprint") ? __instance.sprintSpeed : __instance.normalSpeed; ___moveDirection /= speed * Stat_WellBeing.groundSpeedMultiplier; } } }
private static bool Prefix(ref BlockButton ___button_ChangeDirection) { if (MyInput.GetButton("Sprint")) { MoreSailsMoreSpeed.ToggleAllEnginesDir(); return(false); } return(true); }
private static bool Prefix(ref InteractionMotorWheelPowerButton ___button_EngineOnOff) { if (MyInput.GetButton("Sprint")) { MoreSailsMoreSpeed.ToggleAllEngines(); return(false); } return(true); }
private static bool Prefix ( SteeringWheel __instance, ref bool ___hasBeenPlaced, ref bool ___isDisplayingText, DisplayTextManager ___displayText, ref Network_Player ___localPlayer, ref Semih_Network ___network ) { if (!___hasBeenPlaced) { return(true); } if (MyInput.GetButton("Sprint")) { ___isDisplayingText = true; ___displayText.ShowText("Toggle Engines", MyInput.Keybinds["Interact"].MainKey, 1, "Toggle Engine Direction", MyInput.Keybinds["Rotate"].MainKey, 2); if (MyInput.GetButtonDown("Interact")) { MoreSailsMoreSpeed.ToggleAllEngines(); } if (MyInput.GetButtonDown("Rotate")) { MoreSailsMoreSpeed.ToggleAllEnginesDir(); } } else { ___isDisplayingText = true; ___displayText.ShowText("Hold for more options", MyInput.Keybinds["Sprint"].MainKey, 1, Helper.GetTerm("Game/RotateSmooth2", false), MyInput.Keybinds["Rotate"].MainKey, 2); if (MyInput.GetButtonDown("Rotate")) { ___localPlayer.PlayerScript.SetMouseLookScripts(false); } if (MyInput.GetButtonUp("Rotate")) { ___localPlayer.PlayerScript.SetMouseLookScripts(true); } if (MyInput.GetButton("Rotate")) { float axis = Input.GetAxis("Mouse X"); Message_SteeringWheel_Rotate message = new Message_SteeringWheel_Rotate(Messages.SteeringWheelRotate, ___network.NetworkIDManager, __instance.ObjectIndex, axis); if (Semih_Network.IsHost) { AccessTools.Method("SteeringWheel:Rotate").Invoke(__instance, new object[] { axis }); return(false); } ___network.SendP2P(___network.HostID, message, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game); } } return(false); }
private void Update() { if (GameManager.instance.input_active && player.can_input) { if (MyInput.GetButton("Attack")) { bool skill_used = ProcessSkillButton(MyInput.GetAxis("Attack"), 0); if (skill_used) { MyInput.ClearBuffer("Attack"); } } if (MyInput.GetButtonDown("Skill1", skill_buffer)) { bool skill_used = ProcessSkillButton(MyInput.GetAxis("Skill1"), 1); if (skill_used) { MyInput.ClearBuffer("Skill1"); } } if (MyInput.GetButtonDown("Skill2", skill_buffer)) { bool skill_used = ProcessSkillButton(MyInput.GetAxis("Skill2"), 2); if (skill_used) { MyInput.ClearBuffer("Skill2"); } } if (MyInput.GetButtonDown("Skill3")) { bool skill_used = ProcessSkillButton(MyInput.GetAxis("Skill3"), 3); if (skill_used) { MyInput.ClearBuffer("Skill3"); } } if (MyInput.GetButtonDown("ActiveSkill")) { if (player.inventory.active_item != null) { player.inventory.active_item.active_ability.TryUse(); } } if (MyInput.GetButtonDown("UseConsumable")) { player.inventory.TryUseConsumable(); } } input = new Vector2(MyInput.GetAxis("Horizontal"), MyInput.GetAxis("Vertical")); Move(); }
IEnumerator JumpRoutine() { jumping = true; float time_left = max_jump_hold; bool held = true; while (time_left > 0 && held && !cont.collisions.above) { time_left -= GameManager.GetFixedDeltaTime(player.team); held = held && MyInput.GetButton("Jump"); yield return(new WaitForFixedUpdate()); } MyInput.ClearBuffer("Jump"); jumping = false; }
static public void Postfix(ref PersonController __instance) { if (!EarlsMod.settings.enableDolphinJumping) { return; } var ypos = __instance.transform.position.y; if (ypos >= -2.5 && ypos <= 1.0f) { if (MyInput.GetButton("Jump")) { __instance.SwitchControllerType(ControllerType.Ground); __instance.yVelocity = (-10 * __instance.transform.position.y); } } }
IEnumerator DropRoutine() { cont.RemovePlatformFromMask(); float delay = .15f; while (delay > 0) { yield return(new WaitForFixedUpdate()); delay -= Time.deltaTime; } while (MyInput.GetButton("Drop")) { yield return(new WaitForFixedUpdate()); } cont.AddPlatformToMask(); drop_routine = null; }
protected override void Update() { this.normalSpeed = this.basenormalSpeed * RCM.Cheat.SpeedMultiplier; this.sprintSpeed = this.basesprintSpeed * RCM.Cheat.SpeedMultiplier; this.swimSpeed = this.baseswimSpeed * RCM.Cheat.SpeedMultiplier; if (RCM.Cheat.FlyMode) { this.gravity = 0f; this.controllerType = ControllerType.Ground; bool button = MyInput.GetButton("LeftControl"); bool sprint = MyInput.GetButton("Sprint"); bool button2 = MyInput.GetButton("Jump"); float updown = 0f; if (button2) { updown = 1f; } if (button) { updown = -1f; } Vector3 lhs = new Vector3(MyInput.GetAxis("Strafe"), updown, MyInput.GetAxis("Walk")); this.moveDirection = base.transform.right * lhs.x + base.transform.up * lhs.y + base.transform.forward * lhs.z; this.moveDirection *= sprint ? sprintSpeed : normalSpeed; this.controller.Move(moveDirection * Time.deltaTime); LastFlyMode = true; return; } else { base.Update(); } if (LastFlyMode) { this.gravity = this.basegravity; LastFlyMode = false; } }
static bool Prefix(Sail __instance, ref CanvasHelper ___canvas, ref Network_Player ___localPlayer) { if (!MyInput.GetButton("Sprint")) { return(true); } if (Helper.LocalPlayerIsWithinDistance(__instance.transform.position, Player.UseDistance) && CanvasHelper.ActiveMenu == MenuType.None) { if (MyInput.GetButtonDown("Interact")) { if (Semih_Network.IsHost) { if (__instance.open) { MoreSailsMoreSpeedMod.SailsClose(); } else { MoreSailsMoreSpeedMod.SailsOpen(); } } } if (MyInput.GetButton("Rotate")) { if (___localPlayer.PlayerScript.MouseLookIsActive()) { ___localPlayer.PlayerScript.SetMouseLookScripts(false); } MoreSailsMoreSpeedMod.SailsRotate(Input.GetAxis("Mouse X"), __instance); } else if (MyInput.GetButtonUp("Rotate")) { ___localPlayer.PlayerScript.SetMouseLookScripts(true); } return(false); } else { ___canvas.displayTextManager.HideDisplayTexts(); } return(false); }
private static bool Prefix ( Sail __instance, ref bool ___blockPlaced, ref Network_Player ___localPlayer, ref CanvasHelper ___canvas, ref bool ___isRotating, ref GameObject ___paintCollider, ref Semih_Network ___network ) { if (!___blockPlaced) { return(false); } if (___canvas == null || ___canvas.displayTextManager == null || ___localPlayer == null) { return(false); } if (Helper.LocalPlayerIsWithinDistance(__instance.transform.position, Player.UseDistance) && CanvasHelper.ActiveMenu == MenuType.None) { bool mod = MyInput.GetButton("Sprint"); if (!__instance.open) { if (mod) { ___canvas.displayTextManager.ShowText("Open Sails", MyInput.Keybinds["Interact"].MainKey, 1, "Rotate Sails", MyInput.Keybinds["Rotate"].MainKey, 2); } else { ___canvas.displayTextManager.ShowText("Hold for more options", MyInput.Keybinds["Sprint"].MainKey, 1, "Open", MyInput.Keybinds["Interact"].MainKey, 2, 0, true); ___canvas.displayTextManager.ShowText("Rotate", MyInput.Keybinds["Rotate"].MainKey, 3, 0, false); } } else { if (mod) { ___canvas.displayTextManager.ShowText("Close Sails", MyInput.Keybinds["Interact"].MainKey, 1, "Rotate Sails", MyInput.Keybinds["Rotate"].MainKey, 2); } else { ___canvas.displayTextManager.ShowText("Hold for more options", MyInput.Keybinds["Sprint"].MainKey, 1, "Close", MyInput.Keybinds["Interact"].MainKey, 2, 0, true); ___canvas.displayTextManager.ShowText("Rotate", MyInput.Keybinds["Rotate"].MainKey, 3, 0, false); } } if (MyInput.GetButtonDown("Interact")) { Message_NetworkBehaviour message = new Message_NetworkBehaviour(__instance.open ? Messages.Sail_Close : Messages.Sail_Open, __instance); if (Semih_Network.IsHost) { if (__instance.open) { if (mod) { MoreSailsMoreSpeed.SailsClose(); } else { AccessTools.Method("Sail:Close").Invoke(__instance, null); } } else { if (mod) { MoreSailsMoreSpeed.SailsOpen(); } else { AccessTools.Method("Sail:Open").Invoke(__instance, null); } } ___network.RPC(message, Target.Other, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game); } else { ___network.SendP2P(___network.HostID, message, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game); } } if (MyInput.GetButton("Rotate")) { ___localPlayer.PlayerScript.SetMouseLookScripts(false); ___isRotating = true; } else if (MyInput.GetButtonUp("Rotate")) { if (mod) { MoreSailsMoreSpeed.RotateSailsTo(__instance); } ___localPlayer.PlayerScript.SetMouseLookScripts(true); ___isRotating = false; } if (MyInput.GetButtonUp("Sprint") && ___isRotating) { MoreSailsMoreSpeed.RotateSailsTo(__instance); ___localPlayer.PlayerScript.SetMouseLookScripts(true); ___isRotating = false; return(false); } bool button = MyInput.GetButton("Rotate"); if (button) { float axis = Input.GetAxis("Mouse X"); if (Semih_Network.IsHost) { AccessTools.Method("Sail:Rotate").Invoke(__instance, new object[] { axis }); } else { Message_Sail_Rotate message2 = new Message_Sail_Rotate(Messages.Sail_Rotate, __instance, axis); ___network.SendP2P(___network.HostID, message2, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game); } } ___paintCollider.SetActiveSafe(!button); return(false); } if (___isRotating) { ___isRotating = false; ___localPlayer.PlayerScript.SetMouseLookScripts(true); } ___canvas.displayTextManager.HideDisplayTexts(); return(false); }