Hello !
Is it possible to trigger an animation, event or animation every time the speaker changes ? Note that to i only want animate the subtitle panel.
I have a lot of dialogues where two actors speak on after each other, i would like to add an animation to to the Portrait Name when the speaker changes.
The standard UI subtitle panel component has the possibility to set Show/Hide/Focus/Unfocus triggers, how would one go about triggering something "on Speaker changed" ?
Thanks!
Standard UI subtitle panel : animation when speaker changes
Standard UI subtitle panel : animation when speaker changes
Currently working on ->Squeakross: Home Squeak Home<- Using Dialogue System Save System and other features.
Previous game made with Dialogue system ->The Spirit and The mouse<-
Previous game made with Dialogue system ->The Spirit and The mouse<-
Re: Standard UI subtitle panel : animation when speaker changes
Hi,
It's probably most straightforward to add a script with an OnConversationLine method to the Dialogue Manager, or to the dialogue UI if it's a child of the Dialogue Manager. Example:
It's probably most straightforward to add a script with an OnConversationLine method to the Dialogue Manager, or to the dialogue UI if it's a child of the Dialogue Manager. Example:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class AnimateNewPortraitNames : MonoBehaviour
{
public string lastSpeakerName;
void OnConversationStart(Transform actor) { lastSpeakerName = string.Empty; }
void OnConversationLine(Subtitle subtitle)
{
// Has the speaker changed?
// (Note that this method also runs for the player's lines even if they're not shown as a subtitle.)
if (subtitle.speakerInfo.Name != lastSpeakerName)
{
lastSpeakerName = subtitle.speakerInfo.Name;
// Identify which subtitle panel the subtitle will use:
DialogueActor dialogueActor;
var subtitlePanels = (DialogueManager.dialogueUI as StandardDialogueUI).conversationUIElements.subtitleControls;
var subtitlePanel = subtitlePanels.GetPanel(subtitle, out dialogueActor);
// Play some animation on the subtitle panel's Portrait Name:
subtitlePanel.portraitName.GetComponent<Animator>().Play("Some Animation State");
}
}
}
Re: Standard UI subtitle panel : animation when speaker changes
Ooh thats perfect, thank you Tony!
Currently working on ->Squeakross: Home Squeak Home<- Using Dialogue System Save System and other features.
Previous game made with Dialogue system ->The Spirit and The mouse<-
Previous game made with Dialogue system ->The Spirit and The mouse<-