Ejemplo n.º 1
0
    public void HandleInput(core.EInputAction inInputAction, KeyCode inKeyCode)
    {
        switch (inKeyCode)
        {
        case KeyCode.A:
            UpdateDesireVariableFromKey(inInputAction, out mCurrentState.mIsLeft);
            break;

        case KeyCode.D:
            UpdateDesireVariableFromKey(inInputAction, out mCurrentState.mIsRight);
            break;

        case KeyCode.W:
            UpdateDesireVariableFromKey(inInputAction, out mCurrentState.mIsForward);
            break;

        case KeyCode.S:
            UpdateDesireVariableFromKey(inInputAction, out mCurrentState.mIsBack);
            break;

        case KeyCode.K:
            UpdateDesireVariableFromKey(inInputAction, out mCurrentState.mIsShooting);
            break;

        case KeyCode.B:
            UpdateDesireVariableFromKey(inInputAction, out mCurrentState.mIsBomb);
            break;
        }
    }
Ejemplo n.º 2
0
 void UpdateDesireVariableFromKey(core.EInputAction inInputAction, out bool ioVariable)
 {
     ioVariable = false;
     if (inInputAction == core.EInputAction.EIA_Pressed)
     {
         ioVariable = true;
     }
     else if (inInputAction == core.EInputAction.EIA_Released)
     {
         ioVariable = false;
     }
 }
Ejemplo n.º 3
0
 void UpdateDesireFloatFromKey(core.EInputAction inInputAction, out float ioVariable)
 {
     ioVariable = 0.0f;
     if (inInputAction == core.EInputAction.EIA_Pressed)
     {
         ioVariable = 1.0f;
     }
     else if (inInputAction == core.EInputAction.EIA_Released)
     {
         ioVariable = 0.0f;
     }
 }