private void CheckTransitions(MemeController controller) { if (m_Transitions.Count == 0) { Debug.LogError($"This meme: {Name} has not transitions !"); return; } var minPm = m_Transitions[0].Invoke(controller); // For each transitions, invoke the decision function // Get the transition with the lowest priority it is the one which will be ran for (var i = 1; i < m_Transitions.Count; i++) { var pm = m_Transitions[i].Invoke(controller); // If this transition doesn't request a change, keep iterating if (pm.meme == null) { continue; } // Otherwise if we found a more important transition, pick the minimum one if (pm.priority < minPm.priority) { minPm = pm; } } // Transition to the picked meme if it's valid if (minPm.meme != null) { controller.Transition(minPm.meme); } }