Style Slasher
A dressup combat roguelike created by Scrungle Studios for the 2025 Swinburne Capstone project.
Slasher.Input.Button2DInputHandler Class Reference

A general InputHandler for 2-dimension analogue stick InputActions, that fires each possible direction as a single event. More...

Inheritance diagram for Slasher.Input.Button2DInputHandler:
Inheritance graph
Collaboration diagram for Slasher.Input.Button2DInputHandler:
Collaboration graph

Classes

struct  InputState
 

Public Member Functions

 Button2DInputHandler (string actionMapPath, string actionPath)
 
void OnUpdate ()
 
- Public Member Functions inherited from Slasher.Input.BaseInputHandler
 BaseInputHandler (string actionMapPath, string actionPath)
 

Protected Member Functions

override bool TryAddListeners ()
 Tries to add listeners, if they haven't been added already.
 
override bool TryRemoveListeners ()
 Tries to remove listeners, if they've been added.
 

Properties

Vector2 Value [get]
 
override List< BaseInputReceiverreceivers [get]
 
- Properties inherited from Slasher.Input.BaseInputHandler
List< BaseInputReceiverreceivers [get]
 
InputAction inputAction [get]
 

Events

Action< Vector2 > OnInput [add, remove]
 

Private Types

enum  Directions {
  None = 0 , Up = 1 << 0 , Right = 1 << 2 , Down = 1 << 3 ,
  Left = 1 << 4
}
 

Private Member Functions

void OnInputStart (InputAction.CallbackContext context)
 
void OnInputPerformed (InputAction.CallbackContext context)
 
void OnInputCancelled (InputAction.CallbackContext context)
 

Private Attributes

InputReceiver< Vector2 > input = new()
 
List< BaseInputReceiverreceiversBuffer
 
InputState inputState
 

Static Private Attributes

const float SPAM_DELAY = 0.4f
 
const float SPAM_INTERVAL = 0.2f
 

Detailed Description

A general InputHandler for 2-dimension analogue stick InputActions, that fires each possible direction as a single event.

Member Enumeration Documentation

◆ Directions

Enumerator
None 
Up 
Right 
Down 
Left 

Constructor & Destructor Documentation

◆ Button2DInputHandler()

Slasher.Input.Button2DInputHandler.Button2DInputHandler ( string actionMapPath,
string actionPath )

Member Function Documentation

◆ OnInputCancelled()

void Slasher.Input.Button2DInputHandler.OnInputCancelled ( InputAction.CallbackContext context)
private
Here is the call graph for this function:

◆ OnInputPerformed()

void Slasher.Input.Button2DInputHandler.OnInputPerformed ( InputAction.CallbackContext context)
private
Here is the call graph for this function:

◆ OnInputStart()

void Slasher.Input.Button2DInputHandler.OnInputStart ( InputAction.CallbackContext context)
private
Here is the call graph for this function:

◆ OnUpdate()

void Slasher.Input.Button2DInputHandler.OnUpdate ( )

◆ TryAddListeners()

override bool Slasher.Input.Button2DInputHandler.TryAddListeners ( )
protectedvirtual

Tries to add listeners, if they haven't been added already.

Returns
If listeners were added. Listeners will not be added if they have already been added.

Reimplemented from Slasher.Input.BaseInputHandler.

Here is the call graph for this function:

◆ TryRemoveListeners()

override bool Slasher.Input.Button2DInputHandler.TryRemoveListeners ( )
protectedvirtual

Tries to remove listeners, if they've been added.

The buffered values of receivers are wiped when listeners are removed.

Returns
If listeners were removed. Listeners may not be removed if they haven't been added, or if any receivers still have any listeners for their Actions.

Reimplemented from Slasher.Input.BaseInputHandler.

Here is the call graph for this function:

Member Data Documentation

◆ input

InputReceiver<Vector2> Slasher.Input.Button2DInputHandler.input = new()
private

◆ inputState

InputState Slasher.Input.Button2DInputHandler.inputState
private

◆ receiversBuffer

List<BaseInputReceiver> Slasher.Input.Button2DInputHandler.receiversBuffer
private

◆ SPAM_DELAY

const float Slasher.Input.Button2DInputHandler.SPAM_DELAY = 0.4f
staticprivate

◆ SPAM_INTERVAL

const float Slasher.Input.Button2DInputHandler.SPAM_INTERVAL = 0.2f
staticprivate

Property Documentation

◆ receivers

override List<BaseInputReceiver> Slasher.Input.Button2DInputHandler.receivers
getprotected

◆ Value

Vector2 Slasher.Input.Button2DInputHandler.Value
get

Event Documentation

◆ OnInput

Action<Vector2> Slasher.Input.Button2DInputHandler.OnInput
addremove

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