// Start is called before the first frame update void Start() { states = new Dictionary <string, BState>(); foreach (BState s in editorStates) { s.behaviour.LoadBrain(this); foreach (BPair p in s.transitions) { p.transition.Link(this, p.transitionTo); } states.Add(s.name, s); } currentState = states[startState]; self = GetComponent <Transform>(); }
// Update is called once per frame void Update() { currentState.behaviour.Update(); currentState = states[currentState.EvalTransitions()]; }