Skip to content
GMIKE edited this page Jun 2, 2020 · 11 revisions

Data it's collection of keys and values Data need for sharing between states.

Сontent

Create

//Throw exeption if data already existDatadata=stateMachine.AddData("Key1",Value1);//Return null if data already existDatadata=stateMachine.TryAddData(outboolresult,"Key1",Value1);

Get

//Throw exeption if data not foundDatadata=stateMachine.GetData("Key1");//Return null if data not foundDatadata=stateMachine.TryGetData("Key1",outboolresult);

Exists

//You can check on existsbooldataKey1IsExists=stateMachine.DataExists("key1")

Delete

Delete with name

//Throw exeption if data not foundstateMachine.DeleteData("Key1");stateMachine.TryDeleteData("Key1",outboolresult);;

Delete with object

//Throw exeption if state not foundstateMachine.DeleteState(state1);stateMachine.TryDeleteState(state1);//Throw exeption if data already delete from state machinedata.Delete();data.TryDelete(outboolresult);

Change

Action Syntax

voidActionOnChange(Datadata,objectnewValue){}

Add action

//you can set action with addDatadata=stateMachine.AddData("Key1",Value1,ActionOnChange);//you can set action after addDatadata=stateMachine.TryAddData(outboolresult,"Key1",Value1,ActionOnChange);data.OnChange(ActionOnChange);

Clone this wiki locally