void Salsa_OnTalkStatusChanged(SalsaStatus status) { Debug.Log("Salsa_OnTalkStatusChanged:" + " instance(" + status.instance.GetType() + ")," + " talkerName(" + status.talkerName + ")," + ((status.isTalking) ? "started" : "finished") + " saying " + status.clipName); }
/// <summary> /// Method is called by SALSA broadcast when the talk status has changed /// </summary> /// <param name="status">Status.</param> void Salsa_OnTalkStatusChanged(SalsaStatus status) { for (int i = 0; i < triggers.Length; i++) { if (triggers[i].trigger == CM_SalsaWaypointTriggers.Trigger.Start && status.isTalking) { if (triggers[i].audioClip.name == status.clipName) { movementSpeed = triggers[i].movementSpeed; SetSpeed(movementSpeed); SetWaypoint(triggers[i].waypointIndex); } } if (triggers[i].trigger == CM_SalsaWaypointTriggers.Trigger.End && !status.isTalking) { if (triggers[i].audioClip.name == status.clipName) { movementSpeed = triggers[i].movementSpeed; SetSpeed(movementSpeed); SetWaypoint(triggers[i].waypointIndex); } } } }
/// <summary> /// Here we use the Salsa on talk status changed event to: /// Listen for audio clip starts and stops /// Call custom shape coroutines /// Set and play the next dialog clip /// Look at specific GameObjects /// </summary> /// <param name="status">Status.</param> void Salsa_OnTalkStatusChanged(SalsaStatus status) { if (salsaEvents) { Debug.Log("Salsa_OnTalkStatusChanged:" + " instance(" + status.instance.GetType() + ")," + " talkerName(" + status.talkerName + ")," + ((status.isTalking) ? "started" : "finished") + " saying " + status.clipName); } if (status.clipName == clips[0].name && status.isTalking) // Line 0 start { StartCoroutine(Look(0f, 2f, lookTargets[0])); // Look at camera StartCoroutine(Look(5f, 2f, lookTargets[1])); // Look at door } if (status.clipName == clips[0].name && !status.isTalking) // Line 0 stop { salsa.SetAudioClip(clips[1]); salsa.Play(); } if (status.clipName == clips[1].name && status.isTalking) // Line 1 start { StartCoroutine(Look(0f, 3f, lookTargets[2])); // // Look at vent } if (status.clipName == clips[1].name && !status.isTalking) // Line 1 stop { salsa.SetAudioClip(clips[2]); salsa.Play(); } if (status.clipName == clips[2].name && status.isTalking) // Line 2 start { StartCoroutine(Look(6f, 5f, lookTargets[0])); // // Look at camera } if (status.clipName == clips[2].name && !status.isTalking) // Line 2 stop { StartCoroutine(Look(0f, 2.5f, lookTargets[0])); // Look at camera for 2.5 sec randomEyes.SetCustomShapeRandom(false); // Disable random custom shapes randomEyes.SetCustomShapeOverride("brows_inner_up", 2f); // Override brows_inner_up randomEyes.SetCustomShapeOverride("smile", 2f); // Overrid smile } }
/// <summary> /// Method is called by SALSA broadcast when the talk status has changed /// </summary> /// <param name="status">Status.</param> void Salsa_OnTalkStatusChanged(SalsaStatus status) { // Npc has stopped talking if (!status.isTalking && status.talkerName == npcDialog[npcDialogIndexTracker].npc.name) { // NPC says end dialog if (npcDialog[npcDialogIndexTracker].endDialog) { EndDialog(); } if (!endDialogNpc) { // There are no player responses to this NPC dialog if (npcDialog[npcDialogIndexTracker].playerResponse.Length == 0) { // We're not at the end of the [Npc Dialog] array if (npcDialogIndexTracker < npcDialog.Length - 1) { npcDialogIndexTracker++; // Increment to the Npc dialog showNPCDialog = true; // Show NCP dialog Start(); // Get Salsa type, set audio clip, and play } } else // There are player responses to this NPC dialog { showPlayerResponses = true; } } } // Player has stopped talking if (!status.isTalking && status.talkerName != npcDialog[npcDialogIndexTracker].npc.name) { if (!endDialogNpc || !endDialogPlayer) { showNPCDialog = true; // Show NCP dialog Start(); // Get Salsa type, set audio clip, and play } } }