override public float Run() { if (allowDuringConversations || !DialogueManager.IsConversationActive) { if (actor == null) { GameObject actorGameObject = GameObject.FindGameObjectWithTag("Player"); if (actorGameObject != null) { actor = actorGameObject.transform; } } var bridge = DialogueManager.Instance.GetComponent <AdventureCreatorBridge>(); if (syncData && (bridge != null)) { bridge.SyncAdventureCreatorToLua(); } DialogueManager.Bark(conversation, actor, conversant); if (syncData && (bridge != null)) { bridge.SyncAdventureCreatorToLua(); } } return(0); }
public override TaskStatus OnUpdate() { var conversationTitle = (conversation != null) ? conversation.Value : string.Empty; var speakerTransform = ((speaker != null) && (speaker.Value != null)) ? speaker.Value.transform : null; var listenerTransform = ((listener != null) && (listener.Value != null)) ? listener.Value.transform : null; TaskStatus status = TaskStatus.Failure; // assume failure if (speakerTransform == null) { Debug.LogWarning("StartBark Task: speaker is null"); } else if (string.IsNullOrEmpty(conversationTitle)) { Debug.LogWarning("StartBark Task: conversation title is empty"); } else { if (listenerTransform != null) { DialogueManager.Bark(conversationTitle, speakerTransform, listenerTransform); } else { DialogueManager.Bark(conversationTitle, speakerTransform); } status = TaskStatus.Success; } return(status); }
override public float Run() { /* * This function is called when the action is performed. * * The float to return is the time that the game * should wait before moving on to the next action. * Return 0f to make the action instantenous. * * For actions that take longer than one frame, * you can return "defaultPauseTime" to make the game * re-run this function a short time later. You can * use the isRunning boolean to check if the action is * being run for the first time, eg: */ if (actor == null) { GameObject actorGameObject = GameObject.FindGameObjectWithTag("Player"); if (actorGameObject != null) { actor = actorGameObject.transform; } } AdventureCreatorBridge bridge = DialogueManager.Instance.GetComponent <AdventureCreatorBridge>(); if (syncData && (bridge != null)) { bridge.SyncAdventureCreatorToLua(); } DialogueManager.Bark(conversation, actor, conversant); if (syncData && (bridge != null)) { bridge.SyncAdventureCreatorToLua(); } return(0); }
public override void OnEnter() { string conversationTitle = (conversation != null) ? conversation.Value : string.Empty; Transform speakerTransform = ((speaker != null) && (speaker.Value != null)) ? speaker.Value.transform : null; Transform listenerTransform = ((listener != null) && (listener.Value != null)) ? listener.Value.transform : null; if (speakerTransform == null) { Debug.LogWarning(string.Format("{0}: PlayMaker Action Bark - speaker is null", DialogueDebug.Prefix)); } if (string.IsNullOrEmpty(conversationTitle)) { Debug.LogWarning(string.Format("{0}: PlayMaker Action Bark - conversation title is blank", DialogueDebug.Prefix)); } if (listenerTransform != null) { DialogueManager.Bark(conversationTitle, speakerTransform, listenerTransform); } else { DialogueManager.Bark(conversationTitle, speakerTransform); } Finish(); }