public static bool Is(this InputActivity inputActivity, InputActivity desiredActivity)
 {
     switch (desiredActivity)
     {
         case InputActivity.Idle:
             return inputActivity.IsIdle();
         case InputActivity.Pressed:
             return inputActivity.IsPressed();
         case InputActivity.Released:
             return inputActivity.IsReleased();
         case InputActivity.Triggered:
             return inputActivity.IsTriggered();
         default:
             throw new NotSupportedException();
     }
 }
Esempio n. 2
0
        public void Update(ElapsedTime elapsedTime)
        {
            if (!Enabled)
            {
                return;
            }

            foreach (IInput input in InputSystem.Instance.Sources.SelectMany(x => x.InstantiatedInputs))
            {
                if (InputFilter != null && !InputFilter(input))
                {
                    continue;
                }

                InputActivity inputActivity = input.Activity;
                if (!inputActivity.IsChanged())
                {
                    continue;
                }

                string activityName;
                switch (inputActivity)
                {
                case InputActivity.Triggered:
                    activityName = "triggered";
                    break;

                case InputActivity.Released:
                    activityName = "released";
                    break;

                default: throw new NotSupportedException();
                }

                Logger.Debug($"({input.Source.DisplayName}) {input.DisplayName} is {activityName}");
            }
        }
Esempio n. 3
0
 public static bool Is(this IControl<InputActivity> control, InputActivity desiredActivity)
 {
     InputActivity inputActivity;
     return control.IsActive(out inputActivity) && inputActivity.Is(desiredActivity);
 }
Esempio n. 4
0
 public Control(string name, IInput input, InputActivity desiredActivity = InputActivity.Triggered)
     : this(input, desiredActivity)
 {
     Name = name;
 }
Esempio n. 5
0
 public Control(IInput input, InputActivity desiredActivity = InputActivity.Triggered)
 {
     Input = input;
     DesiredActivity = desiredActivity;
 }