private void UseClub() { // PrimaryAction if (KeybindingController.GetInputDown(GameControls.PrimaryUse) && playerMove.Movement.magnitude == 0) { gcController.PrimaryUseStart(); } else if (KeybindingController.GetInput(GameControls.PrimaryUse)) { gcController.PrimaryUseHeld(); } else if (KeybindingController.GetInputUp(GameControls.PrimaryUse)) { gcController.PrimaryUseEnd(); if (gcController.CurrentMode == GolfClubController.Mode.Golfing) { playerAnimation.SetClubSwing(gcController.GetActiveClubIndex()); EventController.FireEvent(new SendClubSwingAnimation(gcController.GetActiveClubIndex())); } } // Secondary Action if (KeybindingController.GetInputDown(GameControls.SecondaryUse)) { gcController.SecondaryUseStart(); } else if (KeybindingController.GetInput(GameControls.SecondaryUse)) { gcController.SecondaryUseHeld(); } else if (KeybindingController.GetInputUp(GameControls.SecondaryUse)) { gcController.SecondaryUseEnd(); } }
public void CheckSupportBallSpawn() { if (KeybindingController.GetInputDown(GameControls.AbilityBallTwo)) { tM.StepDone(); } }
private void Update() { if (KeybindingController.GetInputDown(GameControls.Escape)) { EscapePressed(); } }
public void CheckStorageBallSpawn() { if (KeybindingController.GetInputDown(GameControls.AbilityBallThree)) { tM.StepDone(); } }
public void CheckOffenseBallSpawn() { if (KeybindingController.GetInputDown(GameControls.AbilityBallOne)) { tM.StepDone(); } }
private void ShowPrompt() { foreach (Prompt item in prompts) { item.textPrompt.text = KeybindingController.GetKeybindName(item.control); } }
private void HandleMiscInput() { if (KeybindingController.GetInputDown(GameControls.PayRespects)) { if (NetworkManager.instance) { NetworkManager.instance.SendPayRespects(); } } }
private void Update() { if (onScreen) { if (KeybindingController.GetInput(GameControls.Jump)) { endScreenUI.SetActive(false); //Go to title or something } } }
public void StopRebindProcess() { Rebinding = false; foreach (KeybindButton keybindButton in keybindButtons) { keybindButton.SetKeybindText(KeybindingController.GetKeybindName(keybindButton.Control)); } StartCoroutine(RemoveUIBlocker()); }
private void Update() { if (onScreen) { if (KeybindingController.GetInput(GameControls.Jump)) { onScreen = false; ToggleVictoryScreen(false); ToggleShowDefeatScreen(false); EventController.FireEvent(new ShowEndScreenMessage()); } } }
private void UseAbilityBall() { if (KeybindingController.GetInputDown(GameControls.AbilityBallOne)) { EventController.FireEvent(new AbilityBallPrepareMessage(this, myAbilities[0], 0)); } else if (KeybindingController.GetInputDown(GameControls.AbilityBallTwo)) { EventController.FireEvent(new AbilityBallPrepareMessage(this, myAbilities[1], 1)); } else if (KeybindingController.GetInputDown(GameControls.AbilityBallThree)) { EventController.FireEvent(new AbilityBallPrepareMessage(this, myAbilities[2], 2)); } }
private void SetUpControlsMenu() { keybindButtons = new List <KeybindButton>(); int controlsCount = System.Enum.GetValues(typeof(GameControls)).Length; float yScale = keybindButtonPrefab.GetComponent <RectTransform>().sizeDelta.y; contentWindow.sizeDelta = new Vector2(contentWindow.sizeDelta.x, (controlsCount - 1) * yScale); // count - 1 so ESCAPE can't be rebound for (int i = 0; i < controlsCount - 1; i++) { GameControls c = (GameControls)i; KeybindButton keybindButton = Instantiate(keybindButtonPrefab, contentWindow); keybindButton.SetUp(-yScale * i, c, KeybindingController.GetKeybindName(c)); keybindButtons.Add(keybindButton); } uiBlocker.SetActive(false); keybindExplanation.SetActive(false); }
public void CycleDefaultControls(int dir) { controlsIndex += dir; if (controlsIndex < 0) { controlsIndex = defaultControlsCount - 1; } else if (controlsIndex >= defaultControlsCount) { controlsIndex = 0; } controlscheme.text = controlSchemes[controlsIndex]; KeybindingController.SetControls(controlsIndex); foreach (KeybindButton kb in keybindButtons) { kb.SetKeybindText(KeybindingController.GetKeybindName(kb.Control)); } }
private void HandleClubSwitching() { if (KeybindingController.GetInputDown(GameControls.NextClub)) { gcController.ScrollClub(1); } else if (KeybindingController.GetInputDown(GameControls.PreviousClub)) { gcController.ScrollClub(-1); } else if (KeybindingController.GetInputDown(GameControls.SwitchToClubOne)) { gcController.ChooseClub(0); } else if (KeybindingController.GetInputDown(GameControls.SwitchToClubTwo)) { gcController.ChooseClub(1); } else if (KeybindingController.GetInputDown(GameControls.SwitchToClubThree)) { gcController.ChooseClub(2); } }
private void HandlePlayerMovement() { horizontalMove = 0; verticalMove = 0; bool jump = false; // If we aren't accepting input / the player gets stunned, we still need to be able to fall from gravity // Therefore, we ensure the Move vars stay at 0 if (acceptInput && !IsDead && !isGameOver) { if (KeybindingController.GetInput(GameControls.Sprint) && gcController.CurrentMode == GolfClubController.Mode.Running) // Can't sprint while golfing { playerMove.ShiftSpeed(); } if (!isConfused) { if (KeybindingController.GetInput(GameControls.MoveForward)) { verticalMove = 1; } else if (KeybindingController.GetInput(GameControls.MoveBackward)) { verticalMove = -1; } else { playerAnimation.SetRun(PlayerAnimation.RunState.stop); } if (KeybindingController.GetInput(GameControls.StrafeRight)) { horizontalMove = 1; } else if (KeybindingController.GetInput(GameControls.StrafeLeft)) { horizontalMove = -1; } } else { if (KeybindingController.GetInput(GameControls.MoveForward)) { horizontalMove = 1; } else if (KeybindingController.GetInput(GameControls.MoveBackward)) { horizontalMove = -1; } if (KeybindingController.GetInput(GameControls.StrafeRight)) { verticalMove = -1; } else if (KeybindingController.GetInput(GameControls.StrafeLeft)) { verticalMove = 1; } } SetRunAnimation(horizontalMove, verticalMove); jump = KeybindingController.GetInputDown(GameControls.Jump); playerMove.RotatePlayer(); } playerMove.MovePlayer(horizontalMove, verticalMove, jump); }
public void OnGUI() { if (Rebinding) { Event e = Event.current; if (e.isKey && e.keyCode != KeyCode.Escape) { KeyCode kc = e.keyCode; KeybindingController.SetControlKeybind(controlToBind, kc); StopRebindProcess(); } else if (e.shift) { if (Input.GetKey(KeyCode.LeftShift)) { KeybindingController.SetControlKeybind(controlToBind, KeyCode.LeftShift); } else { KeybindingController.SetControlKeybind(controlToBind, KeyCode.RightShift); } StopRebindProcess(); } else if (e.isMouse) { switch (e.button) { case 0: KeybindingController.SetControlKeybind(controlToBind, MouseCode.LeftMouseButton); break; case 1: KeybindingController.SetControlKeybind(controlToBind, MouseCode.RightMouseButton); break; case 2: KeybindingController.SetControlKeybind(controlToBind, MouseCode.MiddleMouseButton); break; default: Debug.Log(e.button); break; } StopRebindProcess(); } else if (e.isScrollWheel) { if (e.delta.y < 0) // scroll up { KeybindingController.SetControlKeybind(controlToBind, MouseCode.MouseWheelUp); } else // scroll down { KeybindingController.SetControlKeybind(controlToBind, MouseCode.MouseWheelDown); } StopRebindProcess(); } } }
private void SetUp() { KeybindingController.Init(); // In Future, get Sensitivities from a save file }