public static void JumpPack() { try { if (PlayerMod.GetCurrentCharacter().ToString() != "Loader") { Main.LocalPlayerBody.bodyFlags |= CharacterBody.BodyFlags.IgnoreFallDamage; } var forwardDirection = Main.LocalPlayerBody.GetComponent <InputBankTest>().moveVector.normalized; var aimDirection = Main.LocalPlayerBody.GetComponent <InputBankTest>().aimDirection.normalized; var upDirection = Main.LocalPlayerBody.GetComponent <InputBankTest>().moveVector.y + 1; var downDirection = Main.LocalPlayerBody.GetComponent <InputBankTest>().moveVector.y - 1; var isForward = Vector3.Dot(forwardDirection, aimDirection) > 0f; var isJumping = Main.LocalNetworkUser.inputPlayer.GetButton("Jump"); // ReSharper disable once CompareOfFloatsByEqualityOperator if (isJumping) { Main.LocalPlayerBody.characterMotor.velocity.y = upDirection += 0.75f * jumpPackMul; jumpPackMul++; if (jumpPackMul > 200) { jumpPackMul = 200; } } else { jumpPackMul = 1; } } catch (NullReferenceException) { } }
public static void DrawMovementMenu(float x, float y, float widthSize, int mulY, GUIStyle BGstyle, GUIStyle buttonStyle, GUIStyle OnStyle, GUIStyle OffStyle, GUIStyle LabelStyle, GUIStyle Highlighted) { GUI.Box(new Rect(x + 0f, y + 0f, widthSize + 10, 50f + 45 * mulY), "", BGstyle); GUI.Label(new Rect(x + 5f, y + 5f, widthSize + 10, 85f), "M O V E M E N T M E N U", LabelStyle); if (Main.alwaysSprint) { if (GUI.Button(btn.BtnRect(1, false, "movement"), "A L W A Y S S P R I N T : O N", Navigation.HighlighedCheck(OnStyle, Highlighted, 2, 1))) { Main.alwaysSprint = false; } } else if (!Main.alwaysSprint) { if (GUI.Button(btn.BtnRect(1, false, "movement"), "A L W A Y S S P R I N T : O F F", Navigation.HighlighedCheck(OffStyle, Highlighted, 2, 1))) { Main.alwaysSprint = true; } } if (Main.FlightToggle) { if (GUI.Button(btn.BtnRect(2, false, "movement"), "F L I G H T : O N", Navigation.HighlighedCheck(OnStyle, Highlighted, 2, 2))) { if (PlayerMod.GetCurrentCharacter().ToString() != "Loader") { Main.LocalPlayerBody.bodyFlags &= CharacterBody.BodyFlags.None; } Main.FlightToggle = false; } } else if (GUI.Button(btn.BtnRect(2, false, "movement"), "F L I G H T : O F F", Navigation.HighlighedCheck(OffStyle, Highlighted, 2, 2))) { Main.FlightToggle = true; } if (Main.jumpPackToggle) { if (GUI.Button(btn.BtnRect(3, false, "movement"), "J U M P - P A C K : O N", Navigation.HighlighedCheck(OnStyle, Highlighted, 2, 3))) { if (PlayerMod.GetCurrentCharacter().ToString() != "Loader") { Main.LocalPlayerBody.bodyFlags &= CharacterBody.BodyFlags.None; } Main.jumpPackToggle = false; } } else if (GUI.Button(btn.BtnRect(3, false, "movement"), "J U M P - P A C K : O F F", Navigation.HighlighedCheck(OffStyle, Highlighted, 2, 3))) { Main.jumpPackToggle = true; } }
public static void Flight() { try { if (PlayerMod.GetCurrentCharacter().ToString() != "Loader") { Main.LocalPlayerBody.bodyFlags |= CharacterBody.BodyFlags.IgnoreFallDamage; } var forwardDirection = Main.LocalPlayerBody.GetComponent <InputBankTest>().moveVector.normalized; var aimDirection = Main.LocalPlayerBody.GetComponent <InputBankTest>().aimDirection.normalized; var upDirection = Main.LocalPlayerBody.GetComponent <InputBankTest>().moveVector.y + 1; var downDirection = Main.LocalPlayerBody.GetComponent <InputBankTest>().moveVector.y - 1; var isForward = Vector3.Dot(forwardDirection, aimDirection) > 0f; var isSprinting = Main.alwaysSprint ? Main.LocalPlayerBody.isSprinting : Main.LocalNetworkUser.inputPlayer.GetButton("Sprint"); var isJumping = Main.LocalNetworkUser.inputPlayer.GetButton("Jump"); var isGoingDown = Input.GetKey(KeyCode.X); // ReSharper disable once CompareOfFloatsByEqualityOperator var isStrafing = Main.LocalNetworkUser.inputPlayer.GetAxis("MoveVertical") != 0f; if (isSprinting) { if (!Main.alwaysSprint && !Main.LocalNetworkUser.inputPlayer.GetButton("Sprint")) { Main.LocalPlayerBody.isSprinting = false; } Main.LocalPlayerBody.characterMotor.velocity = forwardDirection * 100f; Main.LocalPlayerBody.characterMotor.velocity.y = upDirection * 0.510005f; if (isStrafing) { if (isForward) { Main.LocalPlayerBody.characterMotor.velocity.y = aimDirection.y * 100f; } else { Main.LocalPlayerBody.characterMotor.velocity.y = aimDirection.y * -100f; } } } else { Main.LocalPlayerBody.characterMotor.velocity = forwardDirection * 50; Main.LocalPlayerBody.characterMotor.velocity.y = upDirection * 0.510005f; if (isStrafing) { if (isForward) { Main.LocalPlayerBody.characterMotor.velocity.y = aimDirection.y * 50; } else { Main.LocalPlayerBody.characterMotor.velocity.y = aimDirection.y * -50; } } } if (isJumping) { Main.LocalPlayerBody.characterMotor.velocity.y = upDirection * 100; } if (isGoingDown) { Main.LocalPlayerBody.characterMotor.velocity.y = downDirection * 100; } } catch (NullReferenceException) { } }