![]() |
Platformer Pro
2.3.2
A platform game kit for Unity.
|
The standard input with reassignable buttons and a set of default key assignments (arrows + z, x, and c). Also handles controllers and user configurable inputs. More...
Public Member Functions | |
override bool | LoadInputData (string dataName) |
Loads the input data from the given player prefs. More... | |
override void | LoadInputData (StandardInputData data) |
Loads the provided input data. More... | |
virtual bool | SaveInputData (string dataName) |
Saves the input data. More... | |
virtual StandardInputData | GetInputData () |
Sets this input to reflect the provided data object. More... | |
void | SetActionButton (int index, ButtonState state) |
override ButtonState | GetActionButtonState (int buttonIndex) |
Get the state of an action button. More... | |
override void | ForceButtonState (int index, ButtonState state) |
Allow some external component to set button state (for current frame only). More... | |
override bool | SetKey (KeyType type, KeyCode keyCode) |
Sets the keyboayrd key that corresponds to a Platform PRO input key. More... | |
override bool | SetKey (KeyType type, KeyCode keyCode, int keyNumber) |
Sets the keyboayrd key that corresponds to a Platform PRO input key. More... | |
override KeyCode | GetKeyForType (KeyType type, int keyNumber) |
Gets the key code for the given type. More... | |
override string | GetAxisForType (KeyType type) |
Gets the name of the axis for the given key type. More... | |
override bool | SetAxis (KeyType type, string axis, bool reverseAxis) |
Sets the joystick axis that corresponds to a Platform PRO input axis. More... | |
override void | ConsumeJumpButton () |
Consumes a jump button down event converting it in to a button held event. This implementation simply zeros out the buffer timer. More... | |
override void | ConsumeRunButton () |
Consumes a run button down event converting it in to a button held event. This implementation simply zeros out the buffer timer. More... | |
override void | ConsumeActionButton (int index) |
Consumes an action button down event converting it in to a button held event. This implementation simply zeros out the buffer timer. More... | |
override bool | SaveInputData () |
Saves the input data usinf the default data name. More... | |
![]() | |
virtual void | Validate (PlatformerProMonoBehaviour myTarget) |
Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More... | |
Public Attributes | |
string | dataToLoad = "Player1" |
Name of the input data file to load by default. More... | |
bool | enableController = true |
Should the controller input be enabled. More... | |
bool | enableKeyboard = true |
Should the keyboard input be enabled. More... | |
string | horizontalAxisName = "Joystick1Axis1" |
The horizontal controller axis. More... | |
bool | reverseHorizontalAxis |
Should we reverse the values of the horizontal axis. More... | |
float | digitalHorizontalThreshold = 0.25f |
Threshold for digital input to be considered non-zero. More... | |
string | verticalAxisName = "Joystick1Axis2" |
The vertical controller axis. More... | |
bool | reverseVerticalAxis |
Should we reverse the values of the vertival axis. More... | |
float | digitalVerticalThreshold = 0.25f |
Threshold for digital input to be considered non-zero. More... | |
string | altHorizontalAxisName = "Joystick1Axis7" |
The horizontal controller axis. More... | |
bool | reverseAltHorizontalAxis |
Should we reverse the values of the horizontal axis. More... | |
float | digitalAltHorizontalThreshold = 0.25f |
Threshold for digital input to be considered non-zero. More... | |
string | altVerticalAxisName = "Joystick1Axis8" |
The alternateVertical controller axis. More... | |
bool | reverseAltVerticalAxis |
Should we reverse the values of the alternate vertival axis. More... | |
float | digitalAltVerticalThreshold = 0.25f |
Threshold for digital input to be considered non-zero. More... | |
KeyCode | right = KeyCode.RightArrow |
The right key. More... | |
KeyCode | left = KeyCode.LeftArrow |
The left key. More... | |
KeyCode | up = KeyCode.UpArrow |
The up key. More... | |
KeyCode | down = KeyCode.DownArrow |
The down key. More... | |
KeyCode | jump = KeyCode.Z |
The jump key. More... | |
KeyCode | run = KeyCode.X |
The run key. More... | |
KeyCode | pause = KeyCode.P |
The pause key. More... | |
KeyCode[] | actionButtons |
The action buttons with the first value in the array being the default. More... | |
![]() | |
int | playerId |
The player who is assigned to this input. More... | |
Static Public Attributes | |
const string | SavedPreferencePrefix = "PP.Input." |
Constant used as a prefix for saving and loading input configuration from player prefs. More... | |
Protected Member Functions | |
virtual void | PreInit () |
Init this instance. More... | |
virtual void | SetInputData (StandardInputData data) |
Sets this input to reflect the provided data object. More... | |
virtual void | ClearKeyCode (KeyCode keyCode) |
Sets any KeyType that has a matching KeyCode to KeyCode.NONE More... | |
virtual ButtonState | GetStateForKey (KeyCode key) |
Gets the button state for given keyboard key. More... | |
Protected Attributes | |
int | lastDigitalVerticalAxisState |
Stores the last state of the vertical axis (digital). More... | |
int | lastDigitalHorizontalAxisState |
Stores the last state of the horizontal axis (digital). More... | |
int | lastDigitalAltVerticalAxisState |
Stores the last state of the alternate vertical axis (digital). More... | |
int | lastDigitalAltHorizontalAxisState |
Stores the last state of the alternate horizontal axis (digital). More... | |
ButtonState[] | forceButtonState |
Allow users to force a state for a given frame. More... | |
bool | consumeJumpButton |
If true the jump button wont report DOWN only HELD. More... | |
bool | consumeRunButton |
If true the run button wont report DOWN only HELD. More... | |
bool[] | consumeActionButton |
If true the given action button wont report DOWN only HELD. More... | |
Properties | |
override string | Header [get] |
Gets the header string used to describe the component. More... | |
override float? | HorizontalAxis [get] |
A float value clamped between -1 for completely left and 1 for compeletely right. 0.5f would mean "half right". This implementation only returns -1.0f, 0.0f or 1.0f. More... | |
override int?? | HorizontalAxisDigital [get] |
A "digital" version of the horizontal axis in which the only valid values are -1 for LEFT, 0 for NONE, and 1 for RIGHT. More... | |
override ButtonState | HorizontalAxisState [get] |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value and wasn't 0; Return ButtonState.UP if the axis state went from != 0 to 0. More... | |
override float? | VerticalAxis [get] |
A float value clamped between -1 for completely DOWN and 1 for completely UP. 0.5f would mean "half up". The exact interpretation of the values is up to the movement behaviours. More... | |
override int?? | VerticalAxisDigital [get] |
A "digital" version of the vertical axis in which the only valid values are -1 for DOWN, 0 for NONE, and 1 for UP. More... | |
override ButtonState | VerticalAxisState [get] |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value and wasn't 0; Return ButtonState.UP if the axis state went from != 0 to 0. More... | |
override float? | AltHorizontalAxis [get] |
A float value clamped between -1 for completely left and 1 for compeletely right. 0.5f would mean "half right". This implementation only returns -1.0f, 0.0f or 1.0f. More... | |
override int?? | AltHorizontalAxisDigital [get] |
A "digital" version of the horizontal axis in which the only valid values are -1 for LEFT, 0 for NONE, and 1 for RIGHT. More... | |
override ButtonState | AltHorizontalAxisState [get] |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value and wasn't 0; Return ButtonState.UP if the axis state went from != 0 to 0. More... | |
override float? | AltVerticalAxis [get] |
A float value clamped between -1 for completely DOWN and 1 for completely UP. 0.5f would mean "half up". The exact interpretation of the values is up to the movement behaviours. More... | |
override int?? | AltVerticalAxisDigital [get] |
A "digital" version of the alternate vertical axis in which the only valid values are -1 for DOWN, 0 for NONE, and 1 for UP. More... | |
override ButtonState | AltVerticalAxisState [get] |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value and wasn't 0; Return ButtonState.UP if the axis state went from != 0 to 0. More... | |
override ButtonState | JumpButton [get] |
State of the jump button. More... | |
override ButtonState | RunButton [get] |
State of the run button. More... | |
override ButtonState | PauseButton [get] |
State of the pause button. More... | |
override ButtonState | ActionButton [get] |
State of the default action button. This could be pickup, attack, etc. If you need more buttons use the additional action use Input.GetActionButtonState() More... | |
override bool | AnyKey [get] |
Returns true if any button or action key is being held. More... | |
![]() | |
abstract float | HorizontalAxis [get] |
A float value clamped between -1 for completely left and 1 for compeletely right. 0.5f would mean "half right". The exact interpretation of the values is up to the movement behaviours. More... | |
abstract int | HorizontalAxisDigital [get] |
A "digital" version of the horizontal axis in which the only valid values are -1 for LEFT, 0 for NONE, and 1 for RIGHT. More... | |
abstract ButtonState | HorizontalAxisState [get] |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value. Return ButtonState.UP if the axis state went from != 0 to 0. More... | |
abstract float | VerticalAxis [get] |
A float value clamped between -1 for completely DOWN and 1 for completely UP. 0.5f would mean "half up". The exact interpretation of the values is up to the movement behaviours. More... | |
abstract int | VerticalAxisDigital [get] |
A "digital" version of the alternate vertical axis in which the only valid values are -1 for DOWN, 0 for NONE, and 1 for UP. More... | |
abstract ButtonState | VerticalAxisState [get] |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value. Return ButtonState.UP if the axis state went from != 0 to 0. More... | |
abstract float | AltHorizontalAxis [get] |
A float value clamped between -1 for completely left and 1 for compeletely right. 0.5f would mean "half right". The exact interpretation of the values is up to the movement behaviours. More... | |
abstract int | AltHorizontalAxisDigital [get] |
A "digital" version of the alternate horizontal axis in which the only valid values are -1 for LEFT, 0 for NONE, and 1 for RIGHT. More... | |
abstract ButtonState | AltHorizontalAxisState [get] |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value. Return ButtonState.UP if the axis state went from != 0 to 0. More... | |
abstract float | AltVerticalAxis [get] |
A float value clamped between -1 for completely DOWN and 1 for completely UP. 0.5f would mean "half up". The exact interpretation of the values is up to the movement behaviours. More... | |
abstract int | AltVerticalAxisDigital [get] |
A "digital" version of the vertical axis in which the only valid values are -1 for DOWN, 0 for NONE, and 1 for UP. More... | |
abstract ButtonState | AltVerticalAxisState [get] |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value. Return ButtonState.UP if the axis state went from != 0 to 0. More... | |
abstract ButtonState | JumpButton [get] |
State of the jump button. More... | |
abstract ButtonState | RunButton [get] |
State of the run button. More... | |
abstract ButtonState | PauseButton [get] |
State of the pause button. More... | |
abstract ButtonState | ActionButton [get] |
State of the default action button. This could be pickup, attack, etc. If you need more buttons use the additional action use Input.GetActionButtonState() More... | |
abstract bool | AnyKey [get] |
Returns true if any button or action key is being pressed. More... | |
![]() | |
virtual string | Header [get] |
Gets the header string used to describe the component. More... | |
virtual string | DocLink [get] |
Gets a link to documentation site. More... | |
virtual string | VideoLink [get] |
Gets a link to a youtube video. More... | |
virtual string | Deprecated [get] |
If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More... | |
The standard input with reassignable buttons and a set of default key assignments (arrows + z, x, and c). Also handles controllers and user configurable inputs.
|
protectedvirtual |
Sets any KeyType that has a matching KeyCode to KeyCode.NONE
keyCode | The key code to match. |
|
virtual |
Consumes an action button down event converting it in to a button held event. This implementation simply zeros out the buffer timer.
Reimplemented from PlatformerPro.Input.
|
virtual |
Consumes a jump button down event converting it in to a button held event. This implementation simply zeros out the buffer timer.
Reimplemented from PlatformerPro.Input.
|
virtual |
Consumes a run button down event converting it in to a button held event. This implementation simply zeros out the buffer timer.
Reimplemented from PlatformerPro.Input.
|
virtual |
Allow some external component to set button state (for current frame only).
index | Index. |
state | State. |
Implements PlatformerPro.Input.
|
virtual |
Get the state of an action button.
buttonIndex | The index of the button. |
Implements PlatformerPro.Input.
Reimplemented in PlatformerPro.TriggerAsButtonInput.
|
virtual |
Gets the name of the axis for the given key type.
type | Type. |
Implements PlatformerPro.Input.
|
virtual |
Sets this input to reflect the provided data object.
data | Data. |
|
virtual |
Gets the key code for the given type.
type | Key type. |
keyNumber | Key number if this is an action key (ignored otherwise). |
Implements PlatformerPro.Input.
|
protectedvirtual |
Gets the button state for given keyboard key.
key | Key to check. |
|
virtual |
|
virtual |
Loads the input data from the given player prefs.
true
, if input data was loaded, false
otherwise.dataName | Player prefs name (constant prefix will be added too). |
Implements PlatformerPro.Input.
|
protectedvirtual |
Init this instance.
|
virtual |
Saves the input data usinf the default data name.
true
, if input data was saved, false
otherwise.Implements PlatformerPro.Input.
|
virtual |
Saves the input data.
true
, if input data was saved, false
otherwise.dataName | Data name. |
void PlatformerPro.StandardInput.SetActionButton | ( | int | index, |
ButtonState | state | ||
) |
|
virtual |
Sets the joystick axis that corresponds to a Platform PRO input axis.
true
, if key was set, false
otherwise.type | Type of key being set. |
axis | Unity axis name. |
reverseAxis | Should we flip the axis? |
Implements PlatformerPro.Input.
|
protectedvirtual |
Sets this input to reflect the provided data object.
data | Data. |
|
virtual |
Sets the keyboayrd key that corresponds to a Platform PRO input key.
true
, if key was set, false
otherwise.type | Type of key being set. |
keyCode | Unity key code. |
Implements PlatformerPro.Input.
|
virtual |
Sets the keyboayrd key that corresponds to a Platform PRO input key.
true
, if key was set, false
otherwise.type | Type of key being set. |
keyNumber | The action key number, ignored if not setting an action key. |
Implements PlatformerPro.Input.
KeyCode [] PlatformerPro.StandardInput.actionButtons |
The action buttons with the first value in the array being the default.
string PlatformerPro.StandardInput.altHorizontalAxisName = "Joystick1Axis7" |
The horizontal controller axis.
string PlatformerPro.StandardInput.altVerticalAxisName = "Joystick1Axis8" |
The alternateVertical controller axis.
|
protected |
If true the given action button wont report DOWN only HELD.
|
protected |
If true the jump button wont report DOWN only HELD.
|
protected |
If true the run button wont report DOWN only HELD.
string PlatformerPro.StandardInput.dataToLoad = "Player1" |
Name of the input data file to load by default.
float PlatformerPro.StandardInput.digitalAltHorizontalThreshold = 0.25f |
Threshold for digital input to be considered non-zero.
float PlatformerPro.StandardInput.digitalAltVerticalThreshold = 0.25f |
Threshold for digital input to be considered non-zero.
float PlatformerPro.StandardInput.digitalHorizontalThreshold = 0.25f |
Threshold for digital input to be considered non-zero.
float PlatformerPro.StandardInput.digitalVerticalThreshold = 0.25f |
Threshold for digital input to be considered non-zero.
KeyCode PlatformerPro.StandardInput.down = KeyCode.DownArrow |
The down key.
bool PlatformerPro.StandardInput.enableController = true |
Should the controller input be enabled.
bool PlatformerPro.StandardInput.enableKeyboard = true |
Should the keyboard input be enabled.
|
protected |
Allow users to force a state for a given frame.
string PlatformerPro.StandardInput.horizontalAxisName = "Joystick1Axis1" |
The horizontal controller axis.
KeyCode PlatformerPro.StandardInput.jump = KeyCode.Z |
The jump key.
|
protected |
Stores the last state of the alternate horizontal axis (digital).
|
protected |
Stores the last state of the alternate vertical axis (digital).
|
protected |
Stores the last state of the horizontal axis (digital).
|
protected |
Stores the last state of the vertical axis (digital).
KeyCode PlatformerPro.StandardInput.left = KeyCode.LeftArrow |
The left key.
KeyCode PlatformerPro.StandardInput.pause = KeyCode.P |
The pause key.
bool PlatformerPro.StandardInput.reverseAltHorizontalAxis |
Should we reverse the values of the horizontal axis.
bool PlatformerPro.StandardInput.reverseAltVerticalAxis |
Should we reverse the values of the alternate vertival axis.
bool PlatformerPro.StandardInput.reverseHorizontalAxis |
Should we reverse the values of the horizontal axis.
bool PlatformerPro.StandardInput.reverseVerticalAxis |
Should we reverse the values of the vertival axis.
KeyCode PlatformerPro.StandardInput.right = KeyCode.RightArrow |
The right key.
KeyCode PlatformerPro.StandardInput.run = KeyCode.X |
The run key.
|
static |
Constant used as a prefix for saving and loading input configuration from player prefs.
KeyCode PlatformerPro.StandardInput.up = KeyCode.UpArrow |
The up key.
string PlatformerPro.StandardInput.verticalAxisName = "Joystick1Axis2" |
The vertical controller axis.
|
get |
State of the default action button. This could be pickup, attack, etc. If you need more buttons use the additional action use Input.GetActionButtonState()
|
get |
A float value clamped between -1 for completely left and 1 for compeletely right. 0.5f would mean "half right". This implementation only returns -1.0f, 0.0f or 1.0f.
|
get |
A "digital" version of the horizontal axis in which the only valid values are -1 for LEFT, 0 for NONE, and 1 for RIGHT.
|
get |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value and wasn't 0; Return ButtonState.UP if the axis state went from != 0 to 0.
|
get |
A float value clamped between -1 for completely DOWN and 1 for completely UP. 0.5f would mean "half up". The exact interpretation of the values is up to the movement behaviours.
|
get |
A "digital" version of the alternate vertical axis in which the only valid values are -1 for DOWN, 0 for NONE, and 1 for UP.
|
get |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value and wasn't 0; Return ButtonState.UP if the axis state went from != 0 to 0.
|
get |
Returns true if any button or action key is being held.
true
if any key; otherwise, false
.
|
get |
Gets the header string used to describe the component.
The header.
|
get |
A float value clamped between -1 for completely left and 1 for compeletely right. 0.5f would mean "half right". This implementation only returns -1.0f, 0.0f or 1.0f.
|
get |
A "digital" version of the horizontal axis in which the only valid values are -1 for LEFT, 0 for NONE, and 1 for RIGHT.
|
get |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value and wasn't 0; Return ButtonState.UP if the axis state went from != 0 to 0.
|
get |
State of the jump button.
|
get |
State of the pause button.
|
get |
State of the run button.
|
get |
A float value clamped between -1 for completely DOWN and 1 for completely UP. 0.5f would mean "half up". The exact interpretation of the values is up to the movement behaviours.
|
get |
A "digital" version of the vertical axis in which the only valid values are -1 for DOWN, 0 for NONE, and 1 for UP.
|
get |
Return ButtonState.DOWN if the axis state went from <= 0 to 1 or >= 0 to -1. Return ButtonState.HELD if the axis stayed at the same value and wasn't 0; Return ButtonState.UP if the axis state went from != 0 to 0.