public void CommsNPCInitiate() { bool friendLineFound = false; foreach (ConversationStarter starterLine in speechController.friendLines) { if ((starterLine.friendName == currentFriend.transform.name) && !friendLineFound) { currentFriend.currentFriend = this; AnimationAudio line = starterLine.friendLine.animatedSpeechLine; currentSpeechLine = starterLine.friendLine; //speechController.PlayClipAndStartAnimatingFace(line.audioLine, line.startDelayInSec, line.animationCues, // line.mouthPoseOverrideTimeInterval, line.emotionCues, line.feelingOverrideTimeInterval, // line.triggerStringForEndingEmotion); //if (currentSpeechLine.triggersActions) { // if (currentSpeechLine.acts.Length > 0) { // for (int i = 0; i < currentSpeechLine.acts.Length; i++) { // actCoord.TriggerAction(currentSpeechLine.acts[i]); // } // } //} RunActionsAndSpeechForLine(currentSpeechLine); currentLineDuration = line.clipLength; currentSpeechLineRefTime = Time.time; speakingAndWaitingToCueOtherNPC = true; currentFriend.contactedByFriend = true; friendLineFound = true; conversationStarted = false; NPCState = StateOfBeing.Conversing; } } }
// Update is called once per frame void Update() { if (conversationStarted && currentFriend != null && currentFriend.transform.GetComponent <TextAndSpeech>() != null) { if (!currentFriend.conversationStarted) { currentFriendSpeechControl = currentFriend.transform.GetComponent <TextAndSpeech>(); CommsNPCInitiate(); } } if (contactedByFriend) { NPCState = StateOfBeing.Conversing; } switch (NPCState) { case StateOfBeing.StandingStill: break; case StateOfBeing.Conversing: if (speakingAndWaitingToCueOtherNPC) { if (Time.time - currentSpeechLineRefTime > currentLineDuration) { Debug.Log("cued, " + this.transform.name); Debug.Log(currentFriend.name); currentFriend.SpeechLineCued(currentSpeechLine.NPCresponseToThisLine); speakingAndWaitingToCueOtherNPC = false; } } break; } ControlBlinking(); ControlGaze(); }
public void SpeechLineCued(Prompt response) { bool friendLineFound = false; foreach (Prompt convoLine in speechController.textLines) { if (response == convoLine) { AnimationAudio line = convoLine.animatedSpeechLine; if (!friendLineFound) { //currentSpeechLine = convoLine; //speechController.PlayClipAndStartAnimatingFace(line.audioLine, line.startDelayInSec, line.animationCues, // line.mouthPoseOverrideTimeInterval, line.emotionCues, line.feelingOverrideTimeInterval, // line.triggerStringForEndingEmotion); //if (currentSpeechLine.triggersActions) { // if (currentSpeechLine.acts.Length > 0) { // for (int i = 0; i < currentSpeechLine.acts.Length; i++) { // actCoord.TriggerAction(currentSpeechLine.acts[i]); // } // } //} currentSpeechLine = convoLine; RunActionsAndSpeechForLine(currentSpeechLine); currentLineDuration = line.clipLength; currentSpeechLineRefTime = Time.time; NPCState = StateOfBeing.Conversing; speakingAndWaitingToCueOtherNPC = true; friendLineFound = true; } } } }