Skip to main content

Mood Service

Description

Tracks the current mood of a single agent and plays that mood's idle animation when it changes. One MoodService is created per agent, not one for the whole scene.

Mood is not set through a method call. The service listens to a MoodEventingService and reacts to MoodEvent values raised on it, which is how a Mood beat changes an agent's mood during playback. See Mood.

MoodService

Interface

Type
IDialogueMoodService

Public Methods

NameParametersReturn TypeDescription
GetMoodStateN/AMoodStateReturns the agent's current mood state.

Raising a MoodEvent changes the agent's mood and plays that mood's idle animation, if it defines one. A mood ID that is not in the agent's MoodRepository is ignored, as is one that matches the current mood. The agent starts in the repository's default mood.

MoodEventingService

Carries mood change requests to whichever MoodService instances are listening.

Fields

NameTypeDescription
moodChangeEventUnityEvent<MoodEvent>Raise this to change the listening agent's mood.

MoodEvent carries a single readonly moodId string.

csharp
var eventing = agent.GetNonVerbalEventingService();
eventing.moodEventingService.moodChangeEvent.Invoke(new MoodEvent("angry"));

NonVerbalEventingService

A per-agent container for the agent's non-verbal eventing. It currently holds the agent's MoodEventingService and is the object you retrieve from AgentChatService.GetNonVerbalEventingService().

Fields

NameTypeDescription
moodEventingServiceMoodEventingServiceThe agent's mood eventing service.