Esempio n. 1
0
 protected override void InitializeButtons()
 {
     base.InitializeButtons();
     ShootButtons[0]  = ShootButton;
     ReloadButtons[0] = ReloadButton;
     ShootButtons[1]  = SecondaryShootButton;
     ButtonList.Add(ReloadButtons[1] = new MMInput.IMButton(PlayerID, "Reload2"));
     for (var i = 2; i < MaximumNumberOfWeapons; i++)
     {
         ButtonList.Add(ShootButtons[i]  = new MMInput.IMButton(PlayerID, "Shoot" + (i + 1)));
         ButtonList.Add(ReloadButtons[i] = new MMInput.IMButton(PlayerID, "Reload" + (i + 1)));
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes the buttons. If you want to add more buttons, make sure to register them here.
 /// </summary>
 protected virtual void InitializeButtons()
 {
     ButtonList = new List <MMInput.IMButton> ();
     ButtonList.Add(JumpButton            = new MMInput.IMButton(PlayerID, "Jump", JumpButtonDown, JumpButtonPressed, JumpButtonUp));
     ButtonList.Add(RunButton             = new MMInput.IMButton(PlayerID, "Run", RunButtonDown, RunButtonPressed, RunButtonUp));
     ButtonList.Add(InteractButton        = new MMInput.IMButton(PlayerID, "Interact", InteractButtonDown, InteractButtonPressed, InteractButtonUp));
     ButtonList.Add(DashButton            = new MMInput.IMButton(PlayerID, "Dash", DashButtonDown, DashButtonPressed, DashButtonUp));
     ButtonList.Add(CrouchButton          = new MMInput.IMButton(PlayerID, "Crouch", CrouchButtonDown, CrouchButtonPressed, CrouchButtonUp));
     ButtonList.Add(SecondaryShootButton  = new MMInput.IMButton(PlayerID, "SecondaryShoot", SecondaryShootButtonDown, SecondaryShootButtonPressed, SecondaryShootButtonUp));
     ButtonList.Add(ShootButton           = new MMInput.IMButton(PlayerID, "Shoot", ShootButtonDown, ShootButtonPressed, ShootButtonUp));
     ButtonList.Add(ReloadButton          = new MMInput.IMButton(PlayerID, "Reload", ReloadButtonDown, ReloadButtonPressed, ReloadButtonUp));
     ButtonList.Add(SwitchWeaponButton    = new MMInput.IMButton(PlayerID, "SwitchWeapon", SwitchWeaponButtonDown, SwitchWeaponButtonPressed, SwitchWeaponButtonUp));
     ButtonList.Add(PauseButton           = new MMInput.IMButton(PlayerID, "Pause", PauseButtonDown, PauseButtonPressed, PauseButtonUp));
     ButtonList.Add(TimeControlButton     = new MMInput.IMButton(PlayerID, "TimeControl", TimeControlButtonDown, TimeControlButtonPressed, TimeControlButtonUp));
     ButtonList.Add(SwitchCharacterButton = new MMInput.IMButton(PlayerID, "SwitchCharacter", SwitchCharacterButtonDown, SwitchCharacterButtonPressed, SwitchCharacterButtonUp));
 }
Esempio n. 3
0
        /// <summary>
        /// Changes the state of our button based on the input value
        /// </summary>
        /// <param name="context"></param>
        /// <param name="imButton"></param>
        protected virtual void BindButton(InputAction.CallbackContext context, MMInput.IMButton imButton)
        {
            var control = context.control;

            if (control is ButtonControl button)
            {
                if (button.wasPressedThisFrame)
                {
                    imButton.State.ChangeState(MMInput.ButtonStates.ButtonDown);
                }
                if (button.wasReleasedThisFrame)
                {
                    imButton.State.ChangeState(MMInput.ButtonStates.ButtonUp);
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes the buttons. If you want to add more buttons, make sure to register them here.
 /// </summary>
 protected virtual void InitializeButtons()
 {
     ButtonList = new List <MMInput.IMButton> ();
     ButtonList.Add(JumpButton            = new MMInput.IMButton(PlayerID, "Jump", JumpButtonDown, JumpButtonPressed, JumpButtonUp));
     ButtonList.Add(SwimButton            = new MMInput.IMButton(PlayerID, "Swim", SwimButtonDown, SwimButtonPressed, SwimButtonUp));
     ButtonList.Add(GlideButton           = new MMInput.IMButton(PlayerID, "Glide", GlideButtonDown, GlideButtonPressed, GlideButtonUp));
     ButtonList.Add(InteractButton        = new MMInput.IMButton(PlayerID, "Interact", InteractButtonDown, InteractButtonPressed, InteractButtonUp));
     ButtonList.Add(JetpackButton         = new MMInput.IMButton(PlayerID, "Jetpack", JetpackButtonDown, JetpackButtonPressed, JetpackButtonUp));
     ButtonList.Add(RunButton             = new MMInput.IMButton(PlayerID, "Run", RunButtonDown, RunButtonPressed, RunButtonUp));
     ButtonList.Add(DashButton            = new MMInput.IMButton(PlayerID, "Dash", DashButtonDown, DashButtonPressed, DashButtonUp));
     ButtonList.Add(FlyButton             = new MMInput.IMButton(PlayerID, "Fly", FlyButtonDown, FlyButtonPressed, FlyButtonUp));
     ButtonList.Add(ShootButton           = new MMInput.IMButton(PlayerID, "Shoot", ShootButtonDown, ShootButtonPressed, ShootButtonUp));
     ButtonList.Add(SecondaryShootButton  = new MMInput.IMButton(PlayerID, "SecondaryShoot", SecondaryShootButtonDown, SecondaryShootButtonPressed, SecondaryShootButtonUp));
     ButtonList.Add(ReloadButton          = new MMInput.IMButton(PlayerID, "Reload", ReloadButtonDown, ReloadButtonPressed, ReloadButtonUp));
     ButtonList.Add(SwitchWeaponButton    = new MMInput.IMButton(PlayerID, "SwitchWeapon", SwitchWeaponButtonDown, SwitchWeaponButtonPressed, SwitchWeaponButtonUp));
     ButtonList.Add(PauseButton           = new MMInput.IMButton(PlayerID, "Pause", PauseButtonDown, PauseButtonPressed, PauseButtonUp));
     ButtonList.Add(SwitchCharacterButton = new MMInput.IMButton(PlayerID, "SwitchCharacter", SwitchCharacterButtonDown, SwitchCharacterButtonPressed, SwitchCharacterButtonUp));
 }
Esempio n. 5
0
        /// <summary>
        /// A coroutine that changes the pressed state one frame later
        /// </summary>
        /// <param name="button"></param>
        /// <returns></returns>
        IEnumerator DelayButtonRelease(MMInput.IMButton button)
        {
            yield return(null);

            button.State.ChangeState(MMInput.ButtonStates.Off);
        }
Esempio n. 6
0
        /// <summary>
        /// A coroutine that changes the pressed state one frame later
        /// </summary>
        /// <param name="button"></param>
        /// <returns></returns>
        IEnumerator DelayButtonPress(MMInput.IMButton button)
        {
            yield return(null);

            button.State.ChangeState(MMInput.ButtonStates.ButtonPressed);
        }
Esempio n. 7
0
 protected override void InitializeButtons()
 {
     base.InitializeButtons();
     ButtonList.Add(ProneButton = new MMInput.IMButton(PlayerID, "Prone"));
 }