public void UpdateTransitions(List <TransitionInfo> groups) { transitions.Clear(); m_acceptKeys = 0; foreach (var group in groups) { var trans = group.GetTransitions(info.ID); if (trans == null) { continue; } foreach (var tran in trans) { var t = StateMachineTransition.Create(stateMachine, tran); if (!t) { continue; } transitions.Add(t); if (t.info.acceptKeyMask == 0) { continue; } m_acceptKeys |= t.info.acceptKeyMask; } } }
private void CreateTransitions() { anyStateTransitions.Clear(); preStateTransitions.Clear(); m_globalKeys.Clear(); var groups = new List <TransitionInfo>(); var g = ConfigManager.Get <TransitionInfo>(transtionGroupId); if (g) { groups.Add(g); } foreach (var sub in subStateMachines) { g = ConfigManager.Get <TransitionInfo>(sub.transitionGroup); if (g) { groups.Add(g); } } foreach (var group in groups) { var pre = group.GetTransitions(-1); foreach (var tran in pre) { var t = StateMachineTransition.Create(this, tran); if (!t) { continue; } preStateTransitions.Add(t); if (t.info.acceptKeyMask == 0) { continue; } if (t.info.acceptGroupMask == 0) { var nk = m_globalKeys.Get(0); m_globalKeys.Set(0, nk | t.info.acceptKeyMask); } else { var gm = t.info.acceptGroupMask; for (var i = 1; i < 64; ++i) { if (!gm.BitMask(i)) { continue; } var nk = m_globalKeys.Get(i); m_globalKeys.Set(i, nk | t.info.acceptKeyMask); } } } var any = group.GetTransitions(0); foreach (var tran in any) { var t = StateMachineTransition.Create(this, tran); if (!t) { continue; } anyStateTransitions.Add(t); if (t.info.acceptKeyMask == 0) { continue; } if (t.info.acceptGroupMask == 0) { var nk = m_globalKeys.Get(0); m_globalKeys.Set(0, nk | t.info.acceptKeyMask); nk = m_globalKeys.Get(0); } else { var gm = t.info.acceptGroupMask; for (var i = 1; i < 64; ++i) { if (!gm.BitMask(i)) { continue; } var nk = m_globalKeys.Get(i); m_globalKeys.Set(i, nk | t.info.acceptKeyMask); } } } } foreach (var state in states) { state.UpdateTransitions(groups); } }