Example #1
0
    internal static KeyCode GetKeysetKey(EKeyset pKeyset, EActionKey pAction)
    {
        string name = GenerateKeysetActionName(pKeyset, pAction);

        if (!PlayerPrefs.HasKey(name))
        {
            return(KeyCode.None);
        }

        return((KeyCode)PlayerPrefs.GetInt(name));
    }
Example #2
0
    private bool IsActionKeyPressed(EActionKey pKey)
    {
        switch (pKey)
        {
        case EActionKey.None:
            break;

        case EActionKey.MoveForward:
            return(Input.GetKey(KeyCode.JoystickButton2) ||
                   Input.GetKey(KeyCode.W) ||
                   btnForward.IsPressed);

        case EActionKey.MoveRight:
            return(Input.GetKey(KeyCode.JoystickButton3) ||
                   Input.GetKey(KeyCode.D) ||
                   btnRight.IsPressed);

        case EActionKey.MoveBack:
            return(Input.GetKey(KeyCode.JoystickButton1) ||
                   Input.GetKey(KeyCode.S) ||
                   btnBack.IsPressed);

        case EActionKey.MoveLeft:
            return(Input.GetKey(KeyCode.JoystickButton0) ||
                   Input.GetKey(KeyCode.A) ||
                   btnLeft.IsPressed);

        case EActionKey.Click:
            return(Input.GetKey(KeyCode.JoystickButton4) ||
                   Input.GetKey(KeyCode.Q));

        case EActionKey.Interact:
            return(Input.GetKey(KeyCode.JoystickButton5) ||
                   Input.GetKey(KeyCode.R));
        }

        return(false);
    }
Example #3
0
 private void SetPlayerActionKey(EKeyset pKeyset, EActionKey pKey, KeyCode pKeyCode)
 {
     PlayerPrefs.SetInt(PlayerPrefsX.GenerateKeysetActionName(pKeyset, pKey), (int)pKeyCode);
 }
Example #4
0
 public static string GenerateKeysetActionName(EKeyset pKeyset, EActionKey pAction)
 {
     return(pKeyset.ToString() + pAction.ToString());
 }