Class PlayerInputManager
Keeps one input slot for each player, with the profile and bindings that player uses. Slot 0 is registered at start with the default bindings.
public sealed class PlayerInputManager
- Inheritance
-
PlayerInputManager
- Inherited Members
Constructors
PlayerInputManager(ILogger<PlayerInputManager>, IInputBindingService)
Created by dependency injection. Registers slot 0 for the first player, with the default bindings.
public PlayerInputManager(ILogger<PlayerInputManager> logger, IInputBindingService defaultBindings)
Parameters
loggerILogger<PlayerInputManager>defaultBindingsIInputBindingService
Properties
Slots
Every registered slot.
public IReadOnlyCollection<PlayerInputSlot> Slots { get; }
Property Value
Methods
GetBindings(int)
Returns the bindings of the slot for playerIndex.
public IInputBindingService GetBindings(int playerIndex = 0)
Parameters
playerIndexint
Returns
GetSlot(int)
Returns the slot for playerIndex. Throws
KeyNotFoundException when that player has no slot.
public PlayerInputSlot GetSlot(int playerIndex = 0)
Parameters
playerIndexint
Returns
RegisterSlot(int, PlayerInputProfile, IInputBindingService)
Adds a slot for playerIndex, with its profile and bindings. Throws
InvalidOperationException when the index already has a slot.
public void RegisterSlot(int playerIndex, PlayerInputProfile profile, IInputBindingService bindingService)
Parameters
playerIndexintprofilePlayerInputProfilebindingServiceIInputBindingService
SetProfile(int, PlayerInputProfile)
Sets the profile of the slot for playerIndex. Throws
KeyNotFoundException when that player has no slot.
public void SetProfile(int playerIndex, PlayerInputProfile profile)
Parameters
playerIndexintprofilePlayerInputProfile