コード例 #1
0
        protected override Status OnExecute(Component agent, IBlackboard bb)
        {
            if (outConnections.Count == 0)
            {
                return(Error("There are no connections to the Multiple Choice Node!"));
            }

            var finalOptions = new Dictionary <IStatement, int>();

            for (var i = 0; i < availableChoices.Count; i++)
            {
                var condition = availableChoices[i].condition;
                if (condition == null || condition.CheckCondition(finalActor.transform, bb))
                {
                    var tempStatement = availableChoices[i].statement.BlackboardReplace(bb);
                    finalOptions[tempStatement] = i;
                }
            }

            if (finalOptions.Count == 0)
            {
                Debug.Log("Multiple Choice Node has no available options. Dialogue Ends");
                DLGTree.Stop(false);
                return(Status.Failure);
            }

            var optionsInfo = new MultipleChoiceRequestInfo(finalActor, finalOptions, availableTime, OnOptionSelected);

            optionsInfo.showLastStatement = inConnections.Count > 0 && inConnections[0].sourceNode is StatementNode;
            DialogueTree.RequestMultipleChoices(optionsInfo);
            return(Status.Running);
        }
コード例 #2
0
ファイル: StatementNode.cs プロジェクト: nemish/cubematters
        protected override Status OnExecute(Component agent, IBlackboard bb)
        {
            var tempStatement = statement.BlackboardReplace(bb);

            DialogueTree.RequestSubtitles(new SubtitlesRequestInfo(finalActor, tempStatement, OnStatementFinish));
            return(Status.Running);
        }
コード例 #3
0
        protected override void OnGraphStoped()
        {
            currentNode     = null;
            currentDialogue = null;

            Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Finished '{0}'", this.name));
            if (OnDialogueFinished != null)
            {
                OnDialogueFinished(this);
            }
        }
コード例 #4
0
        protected override void OnGraphStoped()
        {
            endState        = currentNode != null? (EndState)currentNode.status : EndState.Success;
            currentNode     = null;
            currentDialogue = null;

            Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Finished '{0}'", this.name));
            if (OnDialogueFinished != null)
            {
                OnDialogueFinished(this);
            }
        }
コード例 #5
0
        void OnOptionSelected(int index)
        {
            status = Status.Success;

            System.Action Finalize = () => { DLGTree.Continue(index); };

            if (saySelection)
            {
                var tempStatement = availableChoices[index].statement.BlackboardReplace(graphBlackboard);
                var speechInfo    = new SubtitlesRequestInfo(finalActor, tempStatement, Finalize);
                DialogueTree.RequestSubtitles(speechInfo);
            }
            else
            {
                Finalize();
            }
        }
        void CheckInstance()
        {
            if (IsInstance(subTree))
            {
                return;
            }

            DialogueTree instance = null;

            if (!instances.TryGetValue(subTree, out instance))
            {
                instance           = Graph.Clone <DialogueTree>(subTree);
                instances[subTree] = instance;
            }

            subTree = instance;
        }
コード例 #7
0
        void CheckInstance()
        {
            if (IsInstance(subTree))
            {
                return;
            }

            DialogueTree instance = null;

            if (!instances.TryGetValue(subTree, out instance))
            {
                instance           = Graph.Clone <DialogueTree>(subTree);
                instances[subTree] = instance;
            }

            instance.agent      = graphAgent;
            instance.blackboard = graphBlackboard;
            subTree             = instance;
        }
コード例 #8
0
        ////

        protected override void OnGraphStarted()
        {
            if (currentDialogue != null)
            {
                Debug.LogWarning(string.Format("<b>DialogueTree:</b> Another Dialogue Tree named '{0}' is already running and will be stoped before starting new one '{1}'", currentDialogue.name, this.name));
                currentDialogue.Stop(true);
            }

            currentDialogue = this;

            Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Started '{0}'", this.name));
            if (OnDialogueStarted != null)
            {
                OnDialogueStarted(this);
            }

            if (!(agent is IDialogueActor))
            {
                Debug.Log("<b>DialogueTree:</b> INSTIGATOR agent used in DialogueTree does not implement IDialogueActor. A dummy actor will be used.");
            }

            currentNode = currentNode != null? currentNode : (DTNode)primeNode;
            EnterNode(currentNode);
        }
コード例 #9
0
 bool IsInstance(DialogueTree dt)
 {
     return(instances.Values.Contains(dt));
 }
コード例 #10
0
		protected override void OnGraphStoped(){

			endState = currentNode != null? (EndState)currentNode.status : EndState.Success;
			currentNode = null;
			currentDialogue = null;

			Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Finished '{0}'", this.name));
			if (OnDialogueFinished != null)
				OnDialogueFinished(this);
		}
コード例 #11
0
		////

		protected override void OnGraphStarted(){

			if (currentDialogue != null){
				Debug.LogWarning(string.Format("<b>DialogueTree:</b> Another Dialogue Tree named '{0}' is already running and will be stoped before starting new one '{1}'", currentDialogue.name, this.name ));
				currentDialogue.Stop();
			}

			currentDialogue = this;

			Debug.Log(string.Format("<b>DialogueTree:</b> Dialogue Started '{0}'", this.name));
			if (OnDialogueStarted != null)
				OnDialogueStarted(this);

			if ( !(agent is IDialogueActor) ){
				Debug.Log("<b>DialogueTree:</b> INSTIGATOR agent used in DialogueTree does not implement IDialogueActor. A dummy actor will be used.");
			}

			currentNode = currentNode != null? currentNode : (DTNode)primeNode;
			EnterNode( currentNode );
		}
コード例 #12
0
ファイル: DialogueUGUI.cs プロジェクト: nemish/cubematters
 void OnDialogueStarted(DialogueTree dlg)
 {
     //nothing special...
 }
コード例 #13
0
ファイル: DialogueUGUI.cs プロジェクト: nemish/cubematters
 void OnDialoguePaused(DialogueTree dlg)
 {
     subtitlesGroup.gameObject.SetActive(false);
     optionsGroup.gameObject.SetActive(false);
 }