private void ShowInteractionCreation() { //Enum Dropdown to choose the correct InteractionType EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Type"); m_interactionType = (InteractionType)EditorGUILayout.EnumPopup(m_interactionType); //If the Type is Use, you can choose a Tool. otherwise tool = null if (m_interactionType == InteractionType.Use) { EditorGUILayout.PrefixLabel("Tool"); m_itemTool = (Item)EditorGUILayout.ObjectField(m_itemTool, typeof(Item), true); } EditorGUILayout.EndHorizontal(); //The standard text for the interaction EditorStyles.textField.wordWrap = true; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Text"); m_strText = EditorGUILayout.TextArea(m_strText, GUILayout.MinWidth(200), GUILayout.MinHeight(50)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); //This button actually adds the interaction. This is only possible if the text has been edited. if (GUILayout.Button("Add")) { s_interactableEditing.AddInteraction(new Interaction(s_interactableEditing.GetComponent <UniqueID>().m_strUniqueId, m_interactionType, m_itemTool, m_strText, null)); s_bInteractionFoldouts.Add(false); s_listbAddReaction.Add(false); this.Repaint(); ResetInteraction(); m_bCreatingInteraction = false; } GUI.enabled = true; if (GUILayout.Button("Cancel")) { ResetInteraction(); m_bCreatingInteraction = false; } EditorGUILayout.EndHorizontal(); }
public void Start() { interactable = GetComponent <Interactable>(); interactable.AddInteraction(Cut); }