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

A simple but effective touch input. More...

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

Public Member Functions

override ButtonState GetActionButtonState (int buttonIndex)
 GetActionButtonState 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 bool SaveInputData ()
 Saves the input data. More...
 
override bool LoadInputData (string dataName)
 Loads the input data. More...
 
override void LoadInputData (StandardInputData data)
 Loads the provided input data. More...
 
- Public Member Functions inherited from PlatformerPro.Input
virtual void ConsumeJumpButton ()
 Consumes a jump button down event converting it in to a button held event. Does nothing if the button is in another state. More...
 
virtual void ConsumeRunButton ()
 Consumes a run button down event converting it in to a button held event. Does nothing if the button is in another state. More...
 
virtual void ConsumeActionButton (int index)
 Consumes an action button down event converting it in to a button held event. Does nothing if the button is in another state. 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

GameObject horizontalAxisGo
 GameObject that holds an ITouchAxis to be used as the horizontal axis. More...
 
GameObject verticalAxisGo
 GameObject that holds an ITouchAxis to be used as the vertical axis. More...
 
GameObject jumpButtonGo
 GameObject that holds an ITouchButton to be used as the jump button. More...
 
GameObject runButtonGo
 GameObject that holds an ITouchButton to be used as the run button. More...
 
GameObject[] actionButtonGos
 GameObjects that hold ITouchButtons to be used as the actions buttons. More...
 
GameObject pauseButtonGo
 GameObject that holds an ITouchButton to be used as the pause button. 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...
 

Protected Attributes

ITouchAxis actualHorizontalAxis
 Actual IAxis to use for horizontal axis. More...
 
ITouchAxis actualVerticalAxis
 Actual IAxis to use for vertical axis. More...
 
ITouchButton actualJumpButton
 Actual ITouchButton to use for jump. More...
 
ITouchButton actualRunButton
 Actual ITouchButton to use for run. More...
 
ITouchButton actualPauseButton
 Actual ITouchButton to use for pause. More...
 
ITouchButton[] actualActionButtons
 Array of the actual ITouchButtons to use for actions. More...
 
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 cachedVerticalAxisDigital = UNSET
 Cached state of the vertical axis (digital). More...
 
int cachedHorizontalAxisDigital = UNSET
 Cached state of the horizontal axis (digital). More...
 

Properties

override float HorizontalAxis [get]
 HorizontalAxis More...
 
override int HorizontalAxisDigital [get]
 HorizontalAxisDigital 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]
 VerticalAxis More...
 
override int VerticalAxisDigital [get]
 VerticalAxisDigital 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 ButtonState JumpButton [get]
 JumpButton More...
 
override ButtonStateRunButton [get]
 RunButton More...
 
override ButtonStatePauseButton [get]
 PauseButton More...
 
override ButtonState ActionButton [get]
 ActionButton More...
 
override bool AnyKey [get]
 Returns true if any button or action key is being pressed. 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]
 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...
 
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]
 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...
 
- 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

A simple but effective touch input.

Member Function Documentation

◆ ForceButtonState()

override void PlatformerPro.BasicTouchInput.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.BasicTouchInput.GetActionButtonState ( int  buttonIndex)
virtual

GetActionButtonState

Parameters
buttonIndex
Returns

Implements PlatformerPro.Input.

◆ GetAxisForType()

override string PlatformerPro.BasicTouchInput.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.BasicTouchInput.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.BasicTouchInput.Init ( )
protectedvirtual

Init this instance.

◆ LoadInputData() [1/2]

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

Loads the provided input data.

Parameters
dataData to load.

Implements PlatformerPro.Input.

◆ LoadInputData() [2/2]

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

Loads the input data.

Returns
true, if input data was loaded, false otherwise.
Parameters
dataNameData name.

Implements PlatformerPro.Input.

◆ SaveInputData()

override bool PlatformerPro.BasicTouchInput.SaveInputData ( )
virtual

Saves the input data.

Returns
true

false

Implements PlatformerPro.Input.

◆ SetAxis()

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

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

Returns
true, if key was set, false otherwise.
Parameters
typeType of key being set.
axisUnity axis name.

Implements PlatformerPro.Input.

◆ SetKey() [1/2]

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

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

Returns
true, if key was set, false otherwise.
Parameters
typeType of key being set.
keyCodeUnity key code.

Implements PlatformerPro.Input.

◆ SetKey() [2/2]

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

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

Returns
true, if key was set, false otherwise.
Parameters
typeType of key being set.
keyNumberThe action key number or ignored if not setting an action key

Implements PlatformerPro.Input.

Member Data Documentation

◆ actionButtonGos

GameObject [] PlatformerPro.BasicTouchInput.actionButtonGos

GameObjects that hold ITouchButtons to be used as the actions buttons.

◆ actualActionButtons

ITouchButton [] PlatformerPro.BasicTouchInput.actualActionButtons
protected

Array of the actual ITouchButtons to use for actions.

◆ actualHorizontalAxis

ITouchAxis PlatformerPro.BasicTouchInput.actualHorizontalAxis
protected

Actual IAxis to use for horizontal axis.

◆ actualJumpButton

ITouchButton PlatformerPro.BasicTouchInput.actualJumpButton
protected

Actual ITouchButton to use for jump.

◆ actualPauseButton

ITouchButton PlatformerPro.BasicTouchInput.actualPauseButton
protected

Actual ITouchButton to use for pause.

◆ actualRunButton

ITouchButton PlatformerPro.BasicTouchInput.actualRunButton
protected

Actual ITouchButton to use for run.

◆ actualVerticalAxis

ITouchAxis PlatformerPro.BasicTouchInput.actualVerticalAxis
protected

Actual IAxis to use for vertical axis.

◆ cachedHorizontalAxisDigital

int PlatformerPro.BasicTouchInput.cachedHorizontalAxisDigital = UNSET
protected

Cached state of the horizontal axis (digital).

◆ cachedVerticalAxisDigital

int PlatformerPro.BasicTouchInput.cachedVerticalAxisDigital = UNSET
protected

Cached state of the vertical axis (digital).

◆ horizontalAxisGo

GameObject PlatformerPro.BasicTouchInput.horizontalAxisGo

GameObject that holds an ITouchAxis to be used as the horizontal axis.

◆ jumpButtonGo

GameObject PlatformerPro.BasicTouchInput.jumpButtonGo

GameObject that holds an ITouchButton to be used as the jump button.

◆ lastDigitalHorizontalAxisState

int PlatformerPro.BasicTouchInput.lastDigitalHorizontalAxisState
protected

Stores the last state of the horizontal axis (digital).

◆ lastDigitalVerticalAxisState

int PlatformerPro.BasicTouchInput.lastDigitalVerticalAxisState
protected

Stores the last state of the vertical axis (digital).

◆ pauseButtonGo

GameObject PlatformerPro.BasicTouchInput.pauseButtonGo

GameObject that holds an ITouchButton to be used as the pause button.

◆ runButtonGo

GameObject PlatformerPro.BasicTouchInput.runButtonGo

GameObject that holds an ITouchButton to be used as the run button.

◆ verticalAxisGo

GameObject PlatformerPro.BasicTouchInput.verticalAxisGo

GameObject that holds an ITouchAxis to be used as the vertical axis.

Property Documentation

◆ ActionButton

override ButtonState PlatformerPro.BasicTouchInput.ActionButton
get

ActionButton

◆ AltHorizontalAxis

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

◆ AltHorizontalAxisDigital

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

◆ AltHorizontalAxisState

override ButtonState PlatformerPro.BasicTouchInput.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.

◆ AltVerticalAxis

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

◆ AltVerticalAxisDigital

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

◆ AltVerticalAxisState

override ButtonState PlatformerPro.BasicTouchInput.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.

◆ AnyKey

override bool PlatformerPro.BasicTouchInput.AnyKey
get

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

true if any key; otherwise, false.

◆ HorizontalAxis

override float PlatformerPro.BasicTouchInput.HorizontalAxis
get

HorizontalAxis

◆ HorizontalAxisDigital

override int PlatformerPro.BasicTouchInput.HorizontalAxisDigital
get

HorizontalAxisDigital

◆ HorizontalAxisState

override ButtonState PlatformerPro.BasicTouchInput.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.

◆ JumpButton

override ButtonState PlatformerPro.BasicTouchInput.JumpButton
get

JumpButton

◆ PauseButton

override ButtonState? PlatformerPro.BasicTouchInput.PauseButton
get

PauseButton

◆ RunButton

override ButtonState? PlatformerPro.BasicTouchInput.RunButton
get

RunButton

◆ VerticalAxis

override float PlatformerPro.BasicTouchInput.VerticalAxis
get

VerticalAxis

◆ VerticalAxisDigital

override int PlatformerPro.BasicTouchInput.VerticalAxisDigital
get

VerticalAxisDigital

◆ VerticalAxisState

override ButtonState PlatformerPro.BasicTouchInput.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.


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