Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.BufferedInput Class Reference

An input that buffers the jump, run and action buttons from another input so that the controls can be more forgiving to the user. More...

Inheritance diagram for PlatformerPro.BufferedInput:
PlatformerPro.Input PlatformerPro.PlatformerProMonoBehaviour

Public Member Functions

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 SetAxis (KeyType type, string axis, bool reverseAxis)
 Sets the joystick axis that corresponds to a Platform PRO input axis. 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 SaveInputData ()
 Saves the input data. More...
 
override bool LoadInputData (string dataName)
 Loads the input data for the given data name. More...
 
override void LoadInputData (StandardInputData data)
 Loads the input data for the given data name. 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...
 
- Public Member Functions inherited from PlatformerPro.PlatformerProMonoBehaviour
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

Input input
 The input to buffer. More...
 
float jumpBufferTime = 0.15f
 Time for jump button buffering in seconds. More...
 
float runBufferTime
 Time for run button buffering in seconds. More...
 
float[] actionButtonBufferTimes
 Time for action button buffering in seconds. More...
 
- Public Attributes inherited from PlatformerPro.Input
int playerId
 The player who is assigned to this input. More...
 

Protected Member Functions

virtual void Init ()
 Init this instance. More...
 
virtual void CheckButtons ()
 Chec button states in order to update buffer. More...
 

Protected Attributes

float jumpButtonTimer
 Tracks time since jump button pressed. More...
 
float runButtonTimer
 Tracks time since run button pressed. More...
 
float[] actionButtonTimers
 Tracks times since action buttons pressed. More...
 

Properties

override 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...
 
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]
 Gets the state of the horizontal axis. 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 alternate vertical axis in which the only valid values are -1 for DOWN, 0 for NONE, and 1 for UP. More...
 
override ButtonState VerticalAxisState [get]
 Gets the state of the vertical axis. 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". The exact interpretation of the values is up to the movement behaviours. More...
 
override 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...
 
override ButtonState AltHorizontalAxisState [get]
 Gets the state of the alternate horizontal axis. 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 vertical axis in which the only valid values are -1 for DOWN, 0 for NONE, and 1 for UP. More...
 
override ButtonState AltVerticalAxisState [get]
 Gets the state of the alternate vertical axis. 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]
 Gets the action button. More...
 
override bool AnyKey [get]
 Returns true if any button or action key is being pressed. More...
 
- Properties inherited from PlatformerPro.Input
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...
 
- Properties inherited from PlatformerPro.PlatformerProMonoBehaviour
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...
 

Detailed Description

An input that buffers the jump, run and action buttons from another input so that the controls can be more forgiving to the user.

Member Function Documentation

◆ CheckButtons()

virtual void PlatformerPro.BufferedInput.CheckButtons ( )
protectedvirtual

Chec button states in order to update buffer.

◆ ConsumeActionButton()

override void PlatformerPro.BufferedInput.ConsumeActionButton ( int  index)
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.

◆ ConsumeJumpButton()

override void PlatformerPro.BufferedInput.ConsumeJumpButton ( )
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.

◆ ConsumeRunButton()

override void PlatformerPro.BufferedInput.ConsumeRunButton ( )
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.

◆ ForceButtonState()

override void PlatformerPro.BufferedInput.ForceButtonState ( int  index,
ButtonState  state 
)
virtual

Allow some external component to set button state (for current frame only).

Parameters
indexIndex.
stateState.

Implements PlatformerPro.Input.

◆ GetActionButtonState()

override ButtonState PlatformerPro.BufferedInput.GetActionButtonState ( int  buttonIndex)
virtual

Get the state of an action button.

Returns
The buttons state.
Parameters
buttonIndexThe index of the button.

Implements PlatformerPro.Input.

◆ GetAxisForType()

override string PlatformerPro.BufferedInput.GetAxisForType ( KeyType  type)
virtual

Gets the name of the axis for the given key type.

Returns
The axis name.
Parameters
typeType.

Implements PlatformerPro.Input.

◆ GetKeyForType()

override KeyCode PlatformerPro.BufferedInput.GetKeyForType ( KeyType  type,
int  keyNumber 
)
virtual

Gets the key code for the given type.

Returns
The mathcing KeyCode or keyCode.None if there is no match.
Parameters
typeKey type.
keyNumberKey number if this is an action key (ignored otherwise).

Implements PlatformerPro.Input.

◆ Init()

virtual void PlatformerPro.BufferedInput.Init ( )
protectedvirtual

Init this instance.

◆ LoadInputData() [1/2]

override void PlatformerPro.BufferedInput.LoadInputData ( StandardInputData  data)
virtual

Loads the input data for the given data name.

Parameters
dataNameData to load.
dataData.

Implements PlatformerPro.Input.

◆ LoadInputData() [2/2]

override bool PlatformerPro.BufferedInput.LoadInputData ( string  dataName)
virtual

Loads the input data for the given data name.

Parameters
dataNameData to load.

Implements PlatformerPro.Input.

◆ SaveInputData()

override bool PlatformerPro.BufferedInput.SaveInputData ( )
virtual

Saves the input data.

Returns
true

false

Implements PlatformerPro.Input.

◆ SetAxis()

override bool PlatformerPro.BufferedInput.SetAxis ( KeyType  type,
string  axis,
bool  reverseAxis 
)
virtual

Sets the joystick axis that corresponds to a Platform PRO input axis.

Returns
true

false

Parameters
typeType of key being set.
axisUnity axis name.
reverseAxisShould axis values be reversed.

Implements PlatformerPro.Input.

◆ SetKey() [1/2]

override bool PlatformerPro.BufferedInput.SetKey ( KeyType  type,
KeyCode  keyCode 
)
virtual

Sets the keyboayrd key that corresponds to a Platform PRO input key.

Returns
true

false

Parameters
typeType of key being set.
keyCodeUnity key code.

Implements PlatformerPro.Input.

◆ SetKey() [2/2]

override bool PlatformerPro.BufferedInput.SetKey ( KeyType  type,
KeyCode  keyCode,
int  keyNumber 
)
virtual

Sets the keyboayrd key that corresponds to a Platform PRO input key.

Returns
true

false

Parameters
typeType of key being set.
keyNumberThe action key number or ignored if not setting an action key
keyCodeKey code.

Implements PlatformerPro.Input.

Member Data Documentation

◆ actionButtonBufferTimes

float [] PlatformerPro.BufferedInput.actionButtonBufferTimes

Time for action button buffering in seconds.

◆ actionButtonTimers

float [] PlatformerPro.BufferedInput.actionButtonTimers
protected

Tracks times since action buttons pressed.

◆ input

Input PlatformerPro.BufferedInput.input

The input to buffer.

◆ jumpBufferTime

float PlatformerPro.BufferedInput.jumpBufferTime = 0.15f

Time for jump button buffering in seconds.

◆ jumpButtonTimer

float PlatformerPro.BufferedInput.jumpButtonTimer
protected

Tracks time since jump button pressed.

◆ runBufferTime

float PlatformerPro.BufferedInput.runBufferTime

Time for run button buffering in seconds.

◆ runButtonTimer

float PlatformerPro.BufferedInput.runButtonTimer
protected

Tracks time since run button pressed.

Property Documentation

◆ ActionButton

override ButtonState PlatformerPro.BufferedInput.ActionButton
get

Gets the action button.

The action button.

◆ AltHorizontalAxis

override float PlatformerPro.BufferedInput.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.

The alternate horizontal axis.

◆ AltHorizontalAxisDigital

override int PlatformerPro.BufferedInput.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.

The alternate horizontal axis digital.

◆ AltHorizontalAxisState

override ButtonState PlatformerPro.BufferedInput.AltHorizontalAxisState
get

Gets the state of the alternate horizontal axis.

The state of the alternate horizontal axis.

◆ AltVerticalAxis

override float PlatformerPro.BufferedInput.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.

The alternate vertical axis.

◆ AltVerticalAxisDigital

override int PlatformerPro.BufferedInput.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.

The alternate vertical axis digital.

◆ AltVerticalAxisState

override ButtonState PlatformerPro.BufferedInput.AltVerticalAxisState
get

Gets the state of the alternate vertical axis.

The state of the alternate vertical axis.

◆ AnyKey

override bool PlatformerPro.BufferedInput.AnyKey
get

Returns true if any button or action key is being pressed.

true

false

◆ HorizontalAxis

override float PlatformerPro.BufferedInput.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.

The horizontal axis.

◆ HorizontalAxisDigital

override int PlatformerPro.BufferedInput.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.

The horizontal axis digital.

◆ HorizontalAxisState

override ButtonState PlatformerPro.BufferedInput.HorizontalAxisState
get

Gets the state of the horizontal axis.

The state of the horizontal axis.

◆ JumpButton

override ButtonState PlatformerPro.BufferedInput.JumpButton
get

State of the jump button.

The jump button.

◆ PauseButton

override ButtonState PlatformerPro.BufferedInput.PauseButton
get

State of the pause button.

The pause button.

◆ RunButton

override ButtonState PlatformerPro.BufferedInput.RunButton
get

State of the run button.

The run button.

◆ VerticalAxis

override float PlatformerPro.BufferedInput.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.

The vertical axis.

◆ VerticalAxisDigital

override int PlatformerPro.BufferedInput.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.

The vertical axis digital.

◆ VerticalAxisState

override ButtonState PlatformerPro.BufferedInput.VerticalAxisState
get

Gets the state of the vertical axis.

The state of the vertical axis.


The documentation for this class was generated from the following file: