コード例 #1
0
 // 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>();
 }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     currentState.behaviour.Update();
     currentState = states[currentState.EvalTransitions()];
 }