Page 1 of 1

I wanna know Next State's Name

Posted: 2016/11/09 03:40
by lanslot
i wanna implement a function that follow special string to transition next state,
Just like

Code: Select all

public List<StateLink> nextLinks;
public string nextStateName;
void Update(){
     foreach(StateLink link in nextLinks){
          if(nextStateName.Equals(link.name)){
                Transition(link);
          }
     }
}
but StateLink.name equals ""
what should i do for this function

Re: I wanna know Next State's Name

Posted: 2016/11/09 03:45
by lanslot
ok,i know it
just change link name in StateLink Button
But I have a little advice.
when i link the StateLink to another State, Arbor can auto change StateLink's name
if someone need change StateLink Button's name,you can add field called "Display Name"
how do you think? :D

Re: I wanna know Next State's Name

Posted: 2016/11/09 03:53
by lanslot
Another Question:
How to transmit a Message to another state?

Re: I wanna know Next State's Name

Posted: 2016/11/09 04:15
by caitsithware
i wanna implement a function that follow special string to transition next state,
Is it that you want to get the state name of the connected StateLink?
The code for getting State name from StateLink is as follows.

Code: Select all

public StateLink nextState;
void Update()
{
	State state = stateMachine.GetStateFromID(nextState.stateID);
	if (state != null)
	{
		Debug.Log("NextState : " + state.name);
	}
}
If the field name StateLink.name is complicated, I will change it to displayName.
Another Question:
How to transmit a Message to another state?
Please use InputSlot and OutputSlot to exchange data between State.
http://arbor.caitsithware.com/en/manual ... ulatornode
http://arbor.caitsithware.com/en/manual ... ulatornode