Example #1
0
        public override void Update()
        {
            Magnitude = 0.0;

            foreach (var input in Inputs)
            {
                input.Update();

                if (input is Inputs.BaseButtonInput)
                {
                    Inputs.BaseButtonInput i = input as Inputs.BaseButtonInput;

                    if (i.Pressed)
                    {
                        Magnitude = 1.0;
                        break;
                    }
                }
                else if (input is Inputs.BaseAxisInput)
                {
                    Inputs.BaseAxisInput i = input as Inputs.BaseAxisInput;

                    if (i.Magnitude > Deadzone)
                    {
                        Magnitude = i.Magnitude;
                        break;
                    }
                }
            }
        }
Example #2
0
        public override void Update()
        {
            nowPressed = true;

            if (Inputs.Count == 0)
            {
                nowPressed = false;
            }

            foreach (var combo in Inputs)
            {
                nowPressed = true;

                foreach (var input in combo)
                {
                    input.Update();

                    if (input is Inputs.BaseButtonInput)
                    {
                        Inputs.BaseButtonInput i = input as Inputs.BaseButtonInput;

                        if (i.Pressed == false)
                        {
                            nowPressed = false;
                        }
                        continue;
                    }
                    else if (input is Inputs.BaseAxisInput)
                    {
                        Inputs.BaseAxisInput i = input as Inputs.BaseAxisInput;

                        if (i.Magnitude < 0.01)
                        {
                            nowPressed = false;
                        }
                        continue;
                    }
                }

                if (nowPressed == true)
                {
                    break;
                }
            }

            if (nowPressed == true && lastPressed == false)
            {
                Pressed = true;
            }
            else
            {
                Pressed = false;
            }

            lastPressed = nowPressed;
        }