Exemple #1
0
        private float GetValueFromAxisType(PlayerIndex playerNumber, InputAxisType type)
        {
            switch (type)
            {
            case InputAxisType.LeftStickX:
                return(Input.GamePad(playerNumber).LeftThumbstickX);

            case InputAxisType.LeftStickY:
                return(Input.GamePad(playerNumber).LeftThumbstickY);

            case InputAxisType.RightStickX:
                return(Input.GamePad(playerNumber).RightThumbstickX);

            case InputAxisType.RightStickY:
                return(Input.GamePad(playerNumber).RightThumbstickY);

            case InputAxisType.LeftTrigger:
                return(Input.GamePad(playerNumber).LeftTrigger);

            case InputAxisType.RightTrigger:
                return(Input.GamePad(playerNumber).RightTrigger);

            default:
                return(0);
            }
        }
Exemple #2
0
        public InputAxis RemoveAxis(InputAxisType type)
        {
            var a = Get(type);

            if (a != null)
            {
                axes.Remove(a);
            }

            return(this);
        }
Exemple #3
0
 internal InputAxisBase Get(InputAxisType type)
 {
     foreach (var axis in axes)
     {
         if (axis.GetType() == typeof(InputAxisOfType))
         {
             var t = axis as InputAxisOfType;
             if (t != null)
             {
                 if (t.type == type)
                 {
                     return(t);
                 }
             }
         }
     }
     return(null);
 }
	public InputAxis GetAxis( string axisID, InputAxisType axisType = InputAxisType.Mouse )
	{
		InputAxis newAxis = inputAxes.Find( axis => axisID == axis.Name );

		if( newAxis == null ) 
		{
			if( axisType == InputAxisType.Mouse ) newAxis = new MouseInputAxis();
			else if( axisType == InputAxisType.Keyboard ) newAxis = new KeyboardInputAxis();
			else if( axisType == InputAxisType.PXIe ) newAxis = new PXIeInputAxis();
			else if( axisType == InputAxisType.AnkleBot ) newAxis = new AnkleBotInputAxis();
			else return null;

			if( !newAxis.Init( axisID ) ) return null;

			inputAxes.Add( newAxis );
		}

		return newAxis;
	}
Exemple #5
0
 public InputAxis Set(InputAxisType type)
 {
     axes.Clear();
     Add(type);
     return(this);
 }
Exemple #6
0
 public InputAxis Add(InputAxisType type)
 {
     axes.Add(new InputAxisOfType(type));
     return(this);
 }
Exemple #7
0
 public InputAxisOfType(InputAxisType type)
 {
     this.type = type;
 }
Exemple #8
0
 public bool ContainsAxis(InputAxisType type)
 {
     return(Get(type) != null);
 }
	public void SetAxisType( Int32 typeIndex )
	{
		if( Enum.IsDefined( typeof(InputAxisType), typeIndex ) ) controlAxisType = (InputAxisType) typeIndex;
	}