override public void ShowGUI(List <ActionParameter> parameters) { isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer); if (!isPlayer) { intCharParameterID = Action.ChooseParameterGUI("Character:", parameters, intCharParameterID, ParameterType.GameObject); if (intCharParameterID >= 0) { intCharConstantID = 0; interactionCharacter = null; } else { interactionCharacter = (Char)EditorGUILayout.ObjectField("Character:", interactionCharacter, typeof(Char), true); intCharConstantID = FieldToID(interactionCharacter, intCharConstantID); interactionCharacter = IDToField(interactionCharacter, intCharConstantID, false); } } else { interactionCharacter = AC.KickStarter.player; } handsUsed = (HandsUsed)EditorGUILayout.EnumPopup("Which hand(s) to use", handsUsed); //Get the asset file interactionList = (InteractionObjectList)EditorGUILayout.ObjectField("Interaction Object List:", interactionList, typeof(InteractionObjectList), true); if (interactionList) { //Create a string list for the objects in the list List <string> objects = new List <string>(); int index = 0; if (interactionList.objectList.Count > 0) { foreach (InteractionObjectData datas in interactionList.objectList) { objects.Add(datas.myObject.objectName); index++; } string label = "Object:"; objectNum = EditorGUILayout.Popup(label, objectNum, objects.ToArray()); interactionObject = interactionList.objectList[objectNum].myObject; } } AfterRunningOption(); }
override public void ShowGUI(List <ActionParameter> parameters) { isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer); if (!isPlayer) { intCharParameterID = Action.ChooseParameterGUI("Character:", parameters, intCharParameterID, ParameterType.GameObject); if (intCharParameterID >= 0) { intCharConstantID = 0; interactionCharacter = null; } else { interactionCharacter = (Char)EditorGUILayout.ObjectField("Character:", interactionCharacter, typeof(Char), true); intCharConstantID = FieldToID(interactionCharacter, intCharConstantID); interactionCharacter = IDToField(interactionCharacter, intCharConstantID, false); } } else { interactionCharacter = AC.KickStarter.player; } handsUsed = (HandsUsed)EditorGUILayout.EnumPopup("Which hand(s) to use", handsUsed); //Get the asset file interactionList = (InteractionObjectList)EditorGUILayout.ObjectField("Interaction Object List:", interactionList, typeof(InteractionObjectList), true); if (interactionList) { //Create a string list for the objects in the list List <string> objects = new List <string>(); int index = 0; if (interactionList.objectList.Count > 0) { foreach (InteractionObjectData datas in interactionList.objectList) { objects.Add(datas.myObject.objectName); index++; } string label = "Object:"; objectNum = EditorGUILayout.Popup(label, objectNum, objects.ToArray()); interactionObject = interactionList.objectList[objectNum].myObject; } } if (interactionCharacter != null) { animator = interactionCharacter.GetComponent <Animator>(); //Create a string list for the trigger parameters List <string> triggerList = new List <string>(); int i = 0; if (animator.parameterCount > 0) { foreach (AnimatorControllerParameter parameter in animator.parameters) { triggerList.Add(parameter.name); //If the trigger has been removed for some reason, make sure the variable is still valid if (parameter.nameHash == animatorID) { animatorNum = i; } i++; } if (animatorNum == -1) { Debug.Log("Previously chosen trigger parameter no longer exists!"); animatorNum = 0; animatorID = 0; } string label = "Trigger:"; animatorNum = EditorGUILayout.Popup(label, animatorNum, triggerList.ToArray()); animatorID = animator.parameters[animatorNum].nameHash; trigger = animator.parameters[animatorNum]; } } AfterRunningOption(); }
override public void ShowGUI(List <ActionParameter> parameters) { isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer); if (!isPlayer) { intCharParameterID = Action.ChooseParameterGUI("Character:", parameters, intCharParameterID, ParameterType.GameObject); if (intCharParameterID >= 0) { intCharConstantID = 0; interactionCharacter = null; } else { interactionCharacter = (Char)EditorGUILayout.ObjectField("Character:", interactionCharacter, typeof(Char), true); intCharConstantID = FieldToID(interactionCharacter, intCharConstantID); interactionCharacter = IDToField(interactionCharacter, intCharConstantID, false); } } handsUsed = (HandsUsed)EditorGUILayout.EnumPopup("Which hand(s) to send to interaction", handsUsed); objectType = (ObjectType)EditorGUILayout.EnumPopup("Object Type:", objectType); if (objectType == ObjectType.SceneObject) { objectParameterID = Action.ChooseParameterGUI("Interaction Object:", parameters, objectParameterID, ParameterType.GameObject); if (objectParameterID >= 0) { objectConstantID = 0; interactionObject = null; } else { interactionObject = (SimpleInteractionObject)EditorGUILayout.ObjectField("Interaction Object:", interactionObject, typeof(SimpleInteractionObject), true); objectConstantID = FieldToID(interactionObject, objectConstantID); interactionObject = IDToField(interactionObject, objectConstantID, false); } } else if (objectType == ObjectType.InventoryObject) { if (inventoryManager == null && AdvGame.GetReferences().inventoryManager) { inventoryManager = AdvGame.GetReferences().inventoryManager; } if (settingsManager == null && AdvGame.GetReferences().settingsManager) { settingsManager = AdvGame.GetReferences().settingsManager; } if (inventoryManager) { // Create a string List of the field's names (for the PopUp box) List <string> labelList = new List <string>(); int i = 0; if (parameterID == -1) { invNumber = -1; } if (inventoryManager.items.Count > 0) { foreach (InvItem _item in inventoryManager.items) { labelList.Add(_item.label); // If an item has been removed, make sure selected variable is still valid if (_item.id == invID) { invNumber = i; } i++; } if (invNumber == -1) { // Wasn't found (item was possibly deleted), so revert to zero ACDebug.LogWarning("Previously chosen item no longer exists!"); invNumber = 0; invID = 0; } // parameterID = Action.ChooseParameterGUI("Inventory item:", parameters, parameterID, ParameterType.InventoryItem); if (parameterID >= 0) { invNumber = Mathf.Min(invNumber, inventoryManager.items.Count - 1); invID = -1; } else { invNumber = EditorGUILayout.Popup("Inventory item:", invNumber, labelList.ToArray()); invID = inventoryManager.items[invNumber].id; } // } } } AfterRunningOption(); }