Beispiel #1
0
 void UpdateAxisState(int axis, int desiredValue, ref InputAxisState state)
 {
     if (axis == desiredValue)
     {
         if (state == InputAxisState.Idle)
         {
             state = InputAxisState.Pressed;
         }
         else if (state == InputAxisState.Pressed)
         {
             state = InputAxisState.Holding;
         }
     }
     else
     {
         if (state == InputAxisState.Pressed || state == InputAxisState.Holding)
         {
             state = InputAxisState.Released;
         }
         else if (state == InputAxisState.Released)
         {
             state = InputAxisState.Idle;
         }
     }
 }
Beispiel #2
0
    void Start()
    {
        _shouldUpdate = true;

        _isUpPressed    = InputAxisState.Idle;
        _isDownPressed  = InputAxisState.Idle;
        _isLeftPressed  = InputAxisState.Idle;
        _isRightPressed = InputAxisState.Idle;
    }
Beispiel #3
0
 void UpdateAxisState(int axis, ref InputAxisState positiveState, ref InputAxisState negativeState)
 {
     UpdateAxisState(axis, 1, ref positiveState);
     UpdateAxisState(axis, -1, ref negativeState);
 }