/// <summary> /// Bridges data between an IMLComponent and an AnimatorComponent, specified by an animation vocabulary /// </summary> /// <param name="iMLComponent"></param> /// <param name="anim"></param> /// <param name="animVocab"></param> private void BridgeData(IMLComponent iMLComponent, Animator anim, List <IntToStringWord> animVocab) { // We don't run method if any of the components to bridge is null if ((iMLComponent == null) || (anim == null) || (animVocab == null)) { return; } // Go through all the vocabulary for (int i = 0; i < animVocab.Count; i++) { // Check that the amount of iml outputs is between bounds if (iMLComponent.IMLControllerOutputs.Count >= i + 1) { // Go through each expected word and compare against the first model found foreach (var word in animVocab) { // Is the expected integer a current output? if (word.ExpectedInteger == (int)iMLComponent.IMLControllerOutputs[i][0]) { // If it does, we trigger the animation anim.SetTrigger(word.TranslatedString); } } } } }
/// <summary> /// Unsubscribes an iml component from the list /// </summary> /// <param name="componentToRemove"></param> public static void UnsubscribeIMLComponent(IMLComponent componentToRemove) { // Make sure the list is initialised if (m_IMLComponents == null) { m_IMLComponents = new List <IMLComponent>(); } // Make sure the list contains already the component we want to remove if (m_IMLComponents.Contains(componentToRemove)) { // We remove the component from the list m_IMLComponents.Remove(componentToRemove); } }
/// <summary> /// Subscribes an imlcomponent to the list (avoiding duplicates) /// </summary> /// <param name="newComponentToAdd"></param> public static void SubscribeIMLComponent(IMLComponent newComponentToAdd) { // Make sure the list is initialised if (m_IMLComponents == null) { m_IMLComponents = new List <IMLComponent>(); } // Make sure the list doesn't contain already the component we want to add if (!m_IMLComponents.Contains(newComponentToAdd)) { // We add the component if it it is not in the list already m_IMLComponents.Add(newComponentToAdd); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); imlComponent = target as IMLComponent; // LIST OF IML CONTROLLER OUTPUTS //ShowIMLControllerOutputs(); // BUTTON OBJECTS UPDATE if (GUILayout.Button("Add New GameObject")) { imlComponent.UpdateGameObjectNodes(); imlComponent.GetAllNodes(); } }