platformer
|
Handle input for: Players and IA More...
Classes | |
class | InputDictionary |
Serializable type for input actions/states More... | |
Public Member Functions | |
delegate void | InputActionDelegate (string button) |
callback type for keyup/keydown More... | |
virtual void | Start () |
Init actions Dictionary More... | |
virtual void | Update () |
Listen to changs in Unity Input More... | |
abstract bool | IsActionHeld (string action) |
Returns true while the Action(~Button) is held down. More... | |
abstract bool | IsActionDown (string action) |
Returns true this frame the Action(~Button) is down. NOTE you could miss down event, use Held instead More... | |
abstract bool | IsActionUp (string action) |
Returns true this frame the Action(~Button) is up. NOTE you could miss up event, use Held instead More... | |
abstract bool | IsLeftDown () |
Returns true while Left is down. More... | |
abstract bool | IsRightDown () |
Returns true while Right is down. More... | |
abstract bool | IsUpDown () |
Returns true while Up is down. More... | |
abstract bool | IsDownDown () |
Returns true while Down is down. More... | |
abstract float | GetAxisRawX () |
Returns Input.GetAxisRaw ("Horizontal") or equivalent More... | |
abstract float | GetAxisRawY () |
Returns Input.GetAxisRaw ("Vertical") or equivalent More... | |
abstract Vector2 | GetAxisRaw () |
Returns a Vector2 with GetAxisRawX and GetAxisRawY More... | |
Public Attributes | |
List< string > | listenActions = new List<string> {"Jump", "Attack", "Use", "Run", "Pull"} |
List of all available actions to listen More... | |
InputActionDelegate | onActionUp |
callback when action up (key/button associated is up) More... | |
InputActionDelegate | onActionDown |
callback when action down (key/button associated is down) More... | |
Protected Attributes | |
InputDictionary | actions = new InputDictionary() |
Dictionary of actions/states More... | |
Handle input for: Players and IA
The Action concept is the same as keys for keyboards but it's abstracted to handle the rest with just a single name.
example: action Jump. On keyboard: Space key. PS4: X button. WII: A button.
You map everything to the 'Jump' action, extend the PlatformerInput to read input properly :)
NOTE onActionUp, onActionDown it's the recommended way to handle input rather than calling IsActionUp/Down, because you can miss a frame and don't catch IsActionDown. Or you can use a more reliable version: IsActionHeld
|
pure virtual |
Returns a Vector2 with GetAxisRawX and GetAxisRawY
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
pure virtual |
Returns Input.GetAxisRaw ("Horizontal") or equivalent
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
pure virtual |
Returns Input.GetAxisRaw ("Vertical") or equivalent
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
delegate void UnityPlatformer.PlatformerInput.InputActionDelegate | ( | string | button | ) |
callback type for keyup/keydown
|
pure virtual |
Returns true this frame the Action(~Button) is down. NOTE you could miss down event, use Held instead
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
pure virtual |
Returns true while the Action(~Button) is held down.
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
pure virtual |
Returns true this frame the Action(~Button) is up. NOTE you could miss up event, use Held instead
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
pure virtual |
Returns true while Down is down.
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
pure virtual |
Returns true while Left is down.
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
pure virtual |
Returns true while Right is down.
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
pure virtual |
Returns true while Up is down.
Implemented in UnityPlatformer.DefaultInput, and UnityPlatformer.AIInput.
|
inlinevirtual |
Init actions Dictionary
Reimplemented in UnityPlatformer.DefaultInput.
|
inlinevirtual |
Listen to changs in Unity Input
Reimplemented in UnityPlatformer.DefaultInput.
|
protected |
Dictionary of actions/states
List<string> UnityPlatformer.PlatformerInput.listenActions = new List<string> {"Jump", "Attack", "Use", "Run", "Pull"} |
List of all available actions to listen
InputActionDelegate UnityPlatformer.PlatformerInput.onActionDown |
callback when action down (key/button associated is down)
InputActionDelegate UnityPlatformer.PlatformerInput.onActionUp |
callback when action up (key/button associated is up)