public void Speak(Dialog dial) { interactionManager.isSpeaking = true; agentStatus = dial.agent.GetComponent <AgentStatusManager>(); agentStatus.isSpeaking = true; source.Stop(); if (dial.audioFile != null) { currentDialog = dialogs.Find((AudioClip a) => { return(a.name == dial.audioFile.name); }); } else if (dial.audioFileName != "") { currentDialog = dialogs.Find((AudioClip a) => { return(a.name == dial.audioFileName); }); } if (currentDialog != null) { source.clip = currentDialog; source.Play(); Debug.Log("Dialog: " + currentDialog.name + " with length: " + source.clip.length); Invoke("NotSpeaking", source.clip.length); } else { Debug.Log("Dialog audio not found for: " + dial.audioFileName); } }
void Start() { dm = new DialogManager(); am = new AnimationManager(); queue = new Queue <UnityActionMessage>(); currentAgentStatus = gameObject.GetComponent <AgentStatusManager>(); RunGame(); }
void Start() { dm = new DialogManager(); am = new AnimationManager(); queue = new Queue <UnityActionMessage>(); recManagerObject = GameObject.FindGameObjectWithTag("Agent"); currentAgentStatus = recManagerObject.GetComponent <AgentStatusManager>(); RunGame(); }
/* What is the current state to START the conversation? */ private bool inConversation(Conversation c) { EventSettingValue esv = new EventSettingValue(); AgentStatusManager agent = c.getAgent(); esv.setWantLookedAt(c.getWantLookedAt()); esv.setWantInRange(c.getWantInRange()); esv.setCurrPhysical(agent.getPhysicalState()); return(esv.checkStateMatch()); }
/* ********** Accessors: Event Matches ********** */ private void setWants() { if (currEvent == null || (currEvent.isLastEvent && currEvent.isDone())) { finished = true; Debug.Log(TAG + "ended this conversation."); return; } agent = currEvent.agent.GetComponent <AgentStatusManager>(); wantInRange = currEvent.wantInRange; wantLookedAt = currEvent.wantLookedAt; }
/* ********** Accessors: State Changes ********** */ /* What is the current state to START the event? */ private bool getState(EventIM e) { EventSettingValue esv = new EventSettingValue(); AgentStatusManager agent = e.agent.GetComponent <AgentStatusManager>(); //grabbing author choices from UNITY esv.setWantLookedAt(e.wantLookedAt); esv.setWantInRange(e.wantInRange); //storing the current state of the user esv.setCurrPhysical(agent.getPhysicalState()); return(esv.checkStateMatch()); }
/* Agent will start listening for a response (starts recognition). */ public void Respond(Response r) { response = r; agentStatus = response.agent.GetComponent <AgentStatusManager>(); agentStatus.startListening(); response.start(); addResponses(); //words adding to dictionary keywordRecognizer = new KeywordRecognizer(keywordDictionary.Keys.ToArray()); keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized; keywordRecognizer.Start(); Debug.Log(TAG + agentStatus.name + " is listening..."); if (this.response.timeout > 0) { Invoke("ResponseTimeout", this.response.timeout); } }
private void Start() { dm = new DialogManager(); am = new AnimationManager(); rm = new ResponseManager(); wm = new WildcardManager(); tm = new TriggerManager(); wwm = new WaitManager(); mm = new MoveManager(); em = new EmoteManager(); mcm = new MemoryCheckManager(); sm = new AgentStatusManager(); rm = gameObject.GetComponent <ResponseManager>(); wm = gameObject.GetComponent <WildcardManager>(); tm = gameObject.GetComponent <TriggerManager>(); wwm = gameObject.GetComponent <WaitManager>(); mcm = gameObject.GetComponent <MemoryCheckManager>(); foreach (Transform child in transform) { events.Add(child.GetComponentInChildren <EventIM>()); } start = true; }
public void RunGame() { EventIM e = events.ElementAt(eventIndex); if (e.name != "Trigger") { sm = e.agent.GetComponent <AgentStatusManager>(); } if ((sm.isInRange && sm.isLookedAt && !sm.isSpeaking) || e.name == "Trigger") { memories.Add(eventIndex); Debug.Log("Event index playing..." + eventIndex); switch (e.name) { case "Dialog": dm = e.agent.GetComponent <DialogManager>(); dm.Speak(e.GetComponent <Dialog>()); break; case "Animation": am = e.agent.GetComponent <AnimationManager>(); am.PlayAnimation(e.GetComponent <Animate>()); break; case "Response": rm.Respond(e.GetComponent <Response>()); break; case "Jump": eventIndex = e.GetComponent <Jump>().jumpID - 1; break; case "Wildcard": wm.Wildcard(e.GetComponent <Wildcard>()); break; case "Trigger": tm.Trigger(e.GetComponent <Trigger>()); break; case "Wait": wwm.Waiting(e.GetComponent <Wait>().waitTime); break; case "Move": mm = e.agent.GetComponent <MoveManager>(); mm.StartMoving(e.GetComponent <Move>()); break; case "StopMoving": mm = e.agent.GetComponent <MoveManager>(); mm.Stop(); break; case "Emote": em = e.agent.GetComponent <EmoteManager>(); em.EmotionBlendshape(e.GetComponent <Emote>()); break; case "MemoryCheck": mcm.CheckMemories(e.GetComponent <MemoryCheck>()); break; } eventIndex++; } }