// Use this for initialization void Start() { characterActions = new MyCharacterActions(); characterActions.Left.AddDefaultBinding(Key.LeftArrow); characterActions.Left.AddDefaultBinding(InputControlType.DPadLeft); characterActions.Right.AddDefaultBinding(Key.RightArrow); characterActions.Right.AddDefaultBinding(InputControlType.DPadRight); characterActions.Up.AddDefaultBinding(Key.UpArrow); characterActions.Up.AddDefaultBinding(InputControlType.DPadDown); characterActions.Down.AddDefaultBinding(Key.DownArrow); characterActions.Down.AddDefaultBinding(InputControlType.DPadUp); characterActions.Accelerate.AddDefaultBinding(Key.Space); characterActions.Accelerate.AddDefaultBinding(InputControlType.DPadUp); characterActions.SwitchPolarity.AddDefaultBinding(Key.X); characterActions.SwitchPolarity.AddDefaultBinding(InputControlType.Action3); characterActions.SwitchToNormal.AddDefaultBinding(Key.C); characterActions.SwitchToNormal.AddDefaultBinding(InputControlType.Action2); characterActions.Jump.AddDefaultBinding(Key.Z); characterActions.Jump.AddDefaultBinding(InputControlType.Action1); characterActions.Boost.AddDefaultBinding(Key.V); characterActions.Boost.AddDefaultBinding(InputControlType.Action4); characterActions.Select.AddDefaultBinding(Key.Z); characterActions.Select.AddDefaultBinding(InputControlType.Action4); }
void Start() { playerActions = new MyCharacterActions(); playerController = GameObject.Find("Player").GetComponent <PlayerController>(); healthBar.SetActive(false); Time.timeScale = 1f; audioBank = GameObject.Find("_AudioBank").GetComponent <AudioBank>(); textBank = GameObject.Find("_TextBank").GetComponent <TextBank>(); beginText = textBank.beginText; quitText = textBank.quitText; restartText = textBank.restartText; textBank.healthText.enabled = true; textBank.currentScoreText.enabled = true; StartCoroutine(KamikazeSpawnIncreases()); StartCoroutine(StarshipSpawnIncreases()); StartCoroutine(DisclaimerTimer()); BeginGame(); // StartCoroutine(AcquireInputType()); }
private void Start() { r_joystick = InputManager.ActiveDevice; r_characterActions = new MyCharacterActions(); r_characterActions.Left.AddDefaultBinding(InputControlType.LeftStickLeft); r_characterActions.Right.AddDefaultBinding(InputControlType.LeftStickRight); r_characterActions.Jump.AddDefaultBinding(InputControlType.Action1); r_characterActions.Shoot.AddDefaultBinding(InputControlType.RightTrigger); r_characterActions.Shoot.AddDefaultBinding(InputControlType.LeftTrigger); r_characterActions.Sword.AddDefaultBinding(InputControlType.Action3); r_characterActions.Dash.AddDefaultBinding(InputControlType.RightBumper); r_characterActions.Dash.AddDefaultBinding(InputControlType.LeftBumper); }
void ControllerMenuCursorMovement(MyCharacterActions playerInput, bool holdingDirection) { if (titleMenuParent.activeSelf == false) { float input = playerInput.horizontalAxis.Value; int rawInput = 0; // Get the input from the stick and account for dead zones if (Mathf.Abs(input) < 0.35f) { rawInput = 0; holdingDirection = false; } else if (Mathf.Abs(input) > 0.35f) { rawInput = (int)Mathf.Sign(input) * 1; } // if the player is holding the stick make it so that the cursor dosn't move at super speeds if (Mathf.Abs(rawInput) > 0 && holdingDirection == false) { holdingDirection = true; menuIndex = (menuIndex + rawInput) % (controllerDeviceOptions.Length); // If the player is holding the opposite direction then make the index loop properly if (Mathf.Sign(menuIndex) == -1) { menuIndex = (controllerDeviceOptions.Length) + menuIndex; } // set the menu options for (int i = 0; i < controllerInputOptions.Length; i++) { if (i == menuIndex) { controllerInputOptions[menuIndex].SetActive(true); ControllerSelectEvent.start(); //play audio // Animate the directional arrows if (Mathf.Sign(rawInput) == -1 && leftArrowAnimator.enabled == true && leftArrow.activeSelf == true) { leftArrowAnimator.SetTrigger("IsUsed"); } if (Mathf.Sign(rawInput) == 1 && rightArrowAnimator.enabled == true && rightArrow.activeSelf == true) { rightArrowAnimator.SetTrigger("IsUsed"); } } else { controllerInputOptions[i].SetActive(false); } } } if (playerInput == player1Movement.playerInput) { p1HoldingDirection = holdingDirection; } else if (playerInput == player2Movement.playerInput) { p2HoldingDirection = holdingDirection; } } }