public MultipleChoiceRequestInfo(IDialogueActor actor, Dictionary <IStatement, int> options, float availableTime, Action <int> callback)
 {
     this.actor         = actor;
     this.options       = options;
     this.availableTime = availableTime;
     this.SelectOption  = callback;
 }
 ///Set an actor reference by parameter name
 public void SetActorReference(string paramName, IDialogueActor actor)
 {
     if (behaviour != null)
     {
         behaviour.SetActorReference(paramName, actor);
     }
 }
Beispiel #3
0
        ///Set the target IDialogueActor for the provided key parameter name
        public void SetActorReference(string paramName, IDialogueActor actor)
        {
            var reference = actorParameters.Find(r => r.name == paramName);

            if (reference == null)
            {
                Debug.LogError(string.Format("There is no defined Actor key name '{0}'", paramName));
                return;
            }
            reference.actor = actor;
        }
Beispiel #4
0
        ///Set the target IDialogueActor for the provided key parameter name
        public void SetActorReference(string paramName, IDialogueActor actor)
        {
            var param = actorParameters.Find(p => p.name == paramName);

            if (param == null)
            {
                Logger.LogError(string.Format("There is no defined Actor key name '{0}'", paramName), "Dialogue Tree", this);
                return;
            }
            param.actor = actor;
        }
Beispiel #5
0
        static IEnumerator Internal_ProcessStatement(IStatement statement, IDialogueActor actor, Action finishCallback)
        {
            actor.speech = null;
            if (statement.audio)
            {
                var audioSource = MonoManager.current.gameObject.GetComponent <AudioSource>();
                if (audioSource == null)
                {
                    MonoManager.current.gameObject.AddComponent <AudioSource>();
                }

                audioSource.PlayOneShot(statement.audio);

                float timer = 0;
                actor.speech = statement.text;
                while (timer < statement.audio.length)
                {
                    timer += Time.deltaTime;
                    yield return(null);
                }

                UnityEngine.Object.DestroyImmediate(audioSource);
            }
            else
            {
                for (var i = 0; i < statement.text.Length; i++)
                {
                    actor.speech += statement.text[i];
                    yield return(new WaitForSeconds(0.05f));

                    var c = statement.text[i];
                    if (c == '.' || c == '!' || c == '?')
                    {
                        yield return(new WaitForSeconds(0.5f));
                    }
                    if (c == ',')
                    {
                        yield return(new WaitForSeconds(0.1f));
                    }
                }

                yield return(new WaitForSeconds(1.2f));
            }

            actor.speech = null;
            finishCallback();
        }
 public SubtitlesRequestInfo(IDialogueActor actor, IStatement statement, Action callback)
 {
     this.actor     = actor;
     this.statement = statement;
     this.Continue  = callback;
 }
Beispiel #7
0
 ///Start the DialogueTree with provded actor as instigator and callback
 public void StartDialogue(IDialogueActor instigator, Action <bool> callback)
 {
     StartGraph(instigator is Component? (Component)instigator : instigator.transform, localBlackboard, true, callback);
 }
Beispiel #8
0
 ///Start the DialogueTree with provided actor as Instigator
 public void StartDialogue(IDialogueActor instigator)
 {
     StartGraph(instigator is Component? (Component)instigator : instigator.transform, localBlackboard, true, null);
 }
		///Set the target IDialogueActor for the provided key parameter
		public void SetActorReference(string keyName, IDialogueActor actor){
			var reference = actorParameters.Find(r => r.name == keyName);
			if (reference == null){
				Debug.LogError(string.Format("There is no defined Actor key name '{0}'", keyName));
				return;
			}
			reference.actor = actor;
		}
Beispiel #10
0
 ///Assign a new DialogueTree and Start it
 public void StartDialogue(DialogueTree newTree, IDialogueActor instigator, Action <bool> callback)
 {
     graph = newTree;
     StartDialogue(instigator, callback);
 }
Beispiel #11
0
 ///Start the DialogueTree with provided actor as Instigator
 public void StartDialogue(IDialogueActor instigator)
 {
     StartDialogue(instigator, null);
 }
		//Function with same name as the event is called when the event is dispatched by the Dialogue Tree
		void OnSubtitlesRequest(SubtitlesRequestInfo info){
			
			enabled = true;
			currentActor = info.actor;
			StatementProcessor.ProcessStatement(info.statement, info.actor, info.Continue);
		}
			public ActorParameter(string name, IDialogueActor actor){
				this.name = name;
				this.actor = actor;
			}
		///Start the DialogueTree with provded actor as instigator and callback
		public void StartDialogue(IDialogueActor instigator, Action callback){
			StartGraph(instigator is Component? (Component)instigator : instigator.transform, localBlackboard, callback );
		}
		///Start the DialogueTree with provided actor as Instigator
		public void StartDialogue(IDialogueActor instigator){
			StartGraph(instigator is Component? (Component)instigator : instigator.transform, localBlackboard, null);
		}
 //Function with same name as the event is called when the event is dispatched by the Dialogue Tree
 void OnSubtitlesRequest(SubtitlesRequestInfo info)
 {
     enabled      = true;
     currentActor = info.actor;
     StatementProcessor.ProcessStatement(info.statement, info.actor, info.Continue);
 }
Beispiel #17
0
 ///Start the DialogueTree with provided actor as Instigator
 public void StartDialogue(IDialogueActor instigator)
 {
     graph = GetInstance(graph);
     graph.StartGraph(instigator is Component? (Component)instigator : instigator.transform, blackboard, true, null);
 }
Beispiel #18
0
 ///An *optional* coroutine to process a statement writing text over time to the 'speech' property of the actor as well as playing audio.
 ///These things are though usualy handled by the GUI.
 public static void ProcessStatement(IStatement statement, IDialogueActor actor, Action finishCallback)
 {
     MonoManager.current.StartCoroutine(Internal_ProcessStatement(statement, actor, finishCallback));
 }
Beispiel #19
0
 ///Start the DialogueTree with provded actor as instigator and callback
 public void StartDialogue(IDialogueActor instigator, Action <bool> callback)
 {
     graph = GetInstance(graph);
     graph.StartGraph(instigator is Component? (Component)instigator : instigator.transform, blackboard, true, callback);
 }
Beispiel #20
0
 public ActorParameter(string name, IDialogueActor actor)
 {
     this.name  = name;
     this.actor = actor;
 }
		public SubtitlesRequestInfo(IDialogueActor actor, IStatement statement, Action callback){
			this.actor = actor;
			this.statement = statement;
			this.Continue = callback;
		}