#you are using C events but you re not

1 messages · Page 1 of 1 (latest)

upper compass
#

Ok so this is a class I use to consolidate the players input

public class PlayerActions
{
    private InputAction[] action = new InputAction[10];

    public InputAction Move {get {return action[0];} private set {action[0] = value;}}
    public InputAction Jump {get {return action[1];} private set {action[1] = value;}}
    public InputAction Ragdoll {get {return action[2];} private set {action[2] = value;}}
    public InputAction Aim {get {return action[3];} private set {action[3] = value;}}
    public InputAction Fire {get {return action[4];} private set {action[4] = value;}}
    public InputAction Pickup {get {return action[5];} private set {action[5] = value;}}
    public InputAction Crouch {get {return action[6];} private set {action[6] = value;}}
    public InputAction Dive {get {return action[7];} private set {action[7] = value;}}
    public InputAction Look {get {return action[8];} private set {action[8] = value;}}

    private InputAction Join {get {return action[9];}  set {action[9] = value;}}

    public PlayerActions(PlayerInput playerInput)
    {
        SetActions(playerInput);
    }

    public void SetActions(PlayerInput playerInput)
    {
        Move = playerInput.actions["Move"];
        Jump = playerInput.actions["Jump"];
        Ragdoll = playerInput.actions["Ragdoll"];
        Aim = playerInput.actions["Aim"];
        Fire = playerInput.actions["Fire"];
        Pickup = playerInput.actions["Pickup"];
        Crouch = playerInput.actions["Crouch"];
        Dive = playerInput.actions["Dive"];
        Look = playerInput.actions["Look"];
        Join = playerInput.actions["Join"];
    }

    public void EnableActions()
    {
        foreach (InputAction a in action)
        {
            a.Enable();
        }
    }

    public void DisableActions() 
    {
        foreach (InputAction a in action)
        {
            a.Disable();
        }
    }
}