JUtils
A unity utilities library
JUtils.StateData Class Reference

The data of a state More...

Public Member Functions

 StateData (params object[] arguments)
 Create a new StateData object with its arguments More...
 
Get< T > (int index)
 Get an argument at an index More...
 
bool TryGet< T > (int index, out T argument)
 Try get the argument at an index More...
 
bool Has (int index)
 See if the index exists More...
 
bool Has< T > (int index)
 See if the index exists, and if its of the same type More...
 

Public Attributes

readonly object[] arguments
 

Detailed Description

The data of a state

namespace Example
{
public class StateDataExample : State
{
private GameObject _target;
public override void OnActivate()
{
_target = Data.Get&#60;GameObject>(0);
if (data.TryGet(1, out Transform optionalTransform))
optionalTransform.position = Vector3.zero;
}
public override void OnDeactivate()
{
}
}
}

Constructor & Destructor Documentation

◆ StateData()

JUtils.StateData.StateData ( params object[]  arguments)
inline

Create a new StateData object with its arguments

References JUtils.StateData.arguments.

Member Function Documentation

◆ Get< T >()

T JUtils.StateData.Get< T > ( int  index)
inline

Get an argument at an index

References JUtils.StateData.arguments, and JUtils.StateData.Has().

Here is the call graph for this function:

◆ Has()

bool JUtils.StateData.Has ( int  index)
inline

See if the index exists

References JUtils.StateData.arguments.

Here is the caller graph for this function:

◆ Has< T >()

bool JUtils.StateData.Has< T > ( int  index)
inline

See if the index exists, and if its of the same type

References JUtils.StateData.arguments.

◆ TryGet< T >()

bool JUtils.StateData.TryGet< T > ( int  index,
out T  argument 
)
inline

Try get the argument at an index

References JUtils.StateData.arguments, and JUtils.StateData.Has().

Here is the call graph for this function:

Member Data Documentation

◆ arguments

readonly object [] JUtils.StateData.arguments

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