public void UpdateAxis(InputKeyName keyName, InputEventType type)
    {
        switch (type)
        {
        case InputEventType.Push:
            return;

        case InputEventType.Pushed:
            switch (keyName)
            {
            case InputKeyName.GameUpKey:
                vAxisValue += keyMap.SensetiveV * Time.deltaTime;
                break;

            case InputKeyName.GameDownKey:
                vAxisValue -= keyMap.SensetiveV * Time.deltaTime;
                break;

            case InputKeyName.GameRightKey:
                hAxisValue += keyMap.SensetiveH * Time.deltaTime;
                break;

            case InputKeyName.GameLeftKey:
                hAxisValue -= keyMap.SensetiveH * Time.deltaTime;
                break;
            }
            //Debug.Log($"xHorizontal = {hAxisValue} key info : {keyName.ToString()} {type.ToString()}");
            break;

        case InputEventType.UP:
            switch (keyName)
            {
            case InputKeyName.GameUpKey:
            case InputKeyName.GameDownKey:
                vAxisValue = 0;
                break;

            case InputKeyName.GameRightKey:
            case InputKeyName.GameLeftKey:
                hAxisValue = 0;
                break;
            }
            break;
        }
        vAxisValue = Mathf.Clamp(vAxisValue, -1, 1);
        hAxisValue = Mathf.Clamp(hAxisValue, -1, 1);
    }
Example #2
0
 public static bool isGameArrowKey(this InputKeyName s)
 {
     return(s == InputKeyName.GameDownKey || s == InputKeyName.GameUpKey ||
            s == InputKeyName.GameLeftKey || s == InputKeyName.GameRightKey);
 }
 public bool Desubscribe(InputKeyName keyName, InputEventType eventType, Action action)
 {
     keyMapper[keyName][(int)eventType] -= action;
     return(true);
 }