public bool TryInstantiateTree(out SerializableTree tree) { if (gameObject.activeInHierarchy) { instance = this; } else { instance = Instantiate(this); instance.name = this.name; } tree = instance; return(!gameObject.activeInHierarchy); }
public SerializableTree ExportInstance(DialogueTree export) { if (instance == this) { ExportTree(export); return(this); } else { instance.ExportTree(export); SerializableTree newPrefab = this; #if UNITY_EDITOR newPrefab = UnityEditor.PrefabUtility.ReplacePrefab(instance.gameObject, this, UnityEditor.ReplacePrefabOptions.ConnectToPrefab).GetComponent <SerializableTree>(); newPrefab.instance = instance; #endif return(newPrefab); } }
public SerializableTree InstantiateTree() { if (gameObject.activeInHierarchy) { instance = this; } else { #if UNITY_EDITOR instance = UnityEditor.PrefabUtility.InstantiatePrefab(this) as SerializableTree; #endif if (instance == null) { instance = Instantiate(this); } instance.name = this.name; } return(instance); }
/// <summary> /// Trigger an interaction with this object. /// </summary> public virtual void Interact() { InteractionTarget = Instance; Dialogue.SerializableTree dlg = dialogue; if (Inventory.SelectedItem != null && !Inventory.isObserveIconSelected) { InventoryItem selected = Inventory.SelectedItem; if (selected.Equals(this)) { dlg = null; } else if (this.Equals(Inventory.ObserveItem)) { dlg = null; Inventory.ClearSelection(true); selected.Interact(); } else if (!validInteractions.Contains(selected)) { if (GetType() == typeof(InventoryItem) && selected.validInteractions.Contains((InventoryItem)Instance)) { dlg = null; ReverseInteraction(selected); } else { // This is the default dialogue for invalid combinations. dlg = Player.UseItemDialogue; } } } if (dlg != null) { DialogueManager.StartDialogue(dlg); } }
public void RedirectDialogue(SerializableTree dlg) { DialogueManager.RedirectDialogue(dlg); }