//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- /// <summary> /// Switches a dialog on a <see cref="Talkative" /> object. /// </summary> /// <param name="graphEngine"> /// The graph traversal engine that called into this node. ///</param> public override void Handle(GraphEngine graphEngine) { if (Target != null) { if (Dialog == null) { Debug.LogWarning("DialogSwitch object has no graphs attached to switch."); return; } // If the game object exists, it means the Target is in the current scene. if (Target.gameObject != null) { Talkative talkative = Target.gameObject.GetComponent <Talkative>(); AutoGraph dialog = Dialog.gameObject.GetComponent <AutoGraph>(); talkative.Dialog = dialog; } // Tell the save system that we're switching out dialogs. Store(); } else { Debug.LogWarning("DialogSwitch object has no target!"); } }
public void Switch() { if (Target != null) { // If the game object exists, that means we're in the scene the object // belongs in. if (Target.gameObject != null) { Talkative talkative = Target.gameObject.GetComponent <Talkative>(); AutoGraph dialog = Dialog.gameObject.GetComponent <AutoGraph>(); talkative.Dialog = dialog; } // Tell the save system that we're switching out dialogs. Store(); } else { Debug.LogWarning("DialogSwitch object has no target!"); } }