Raymond Maarloeve
Loading...
Searching...
No Matches
NPC Class Reference

Represents a Non-Player Character (NPC) in the game world. Handles decision making, vision, memory, and interaction logic for the NPC. More...

Public Member Functions

void Awake ()
 Initializes the NPC, sets up the entity ID, animator, and subscribes to the NPC event bus.
 
void Setup (IDecisionSystem decisionSystem, string modelId, CharacterDTO characterDTO)
 Sets up the NPC's decision system, model, name, and system prompt. Initializes default memories.
 
IDecision GetCurrentDecision ()
 Gets the current decision being executed by the NPC.
 
IDecisionSystem GetDecisionSystem ()
 Gets the decision system used by the NPC.
 
void LookAt (Transform targetTransform)
 Makes the NPC look at a specified target transform. Updates the NPC's rotation to face the target. If the target is null, resets the rotation to the previous value. Logs the action for debugging purposes.
 
List< CurrentEnvironmentGetCurrentEnvironment ()
 Returns a list of possible environment descriptions for the NPC.
 
void OnDestroy ()
 Unsubscribes from the NPC event bus when the NPC is destroyed.
 
void OnInteraction ()
 Called when Player starts interacting with NPC, see PlayerController::StartInteraction NPC will look at Player and StoppedDecision will be set to currentDecision
 
IEnumerator DrawConclusions (List< Message > conversation)
 Coroutine that draws conclusions from conversation using Narrator LLM Model,.
 

Public Attributes

IDecision StoppedDecision
 Interrupted Decision, see OnInteraction
 
NavMeshAgent agent
 The NavMeshAgent component for navigation.
 
GameObject HisBuilding = null
 The building associated with this NPC.
 
float Hunger = 0f
 The hunger level of the NPC.
 
float Thirst = 0f
 The thirst level of the NPC.
 
float speed = 3f
 The movement speed of the NPC.
 

Properties

CharacterDTO CharacterData [get]
 The Character data generated by Narrator.
 
string SystemPrompt = null [get, set]
 The system prompt used for LLM-based decision making.
 
string ModelID = null [get]
 The model ID used for LLM-based decision making.
 
string NpcName = null [get]
 The name of the NPC.
 
List< ObtainedMemoryObtainedMemories = new() [get]
 The list of memories obtained by the NPC.
 
int EntityID [get]
 The unique entity ID of the NPC.
 

Detailed Description

Represents a Non-Player Character (NPC) in the game world. Handles decision making, vision, memory, and interaction logic for the NPC.

Member Function Documentation

◆ Awake()

void NPC.Awake ( )

Initializes the NPC, sets up the entity ID, animator, and subscribes to the NPC event bus.

◆ DrawConclusions()

IEnumerator NPC.DrawConclusions ( List< Message conversation)

Coroutine that draws conclusions from conversation using Narrator LLM Model,.

Returns
IEnumerator for coroutine execution.

◆ GetCurrentDecision()

IDecision NPC.GetCurrentDecision ( )

Gets the current decision being executed by the NPC.

Returns
The current decision.

◆ GetCurrentEnvironment()

List< CurrentEnvironment > NPC.GetCurrentEnvironment ( )

Returns a list of possible environment descriptions for the NPC.

Returns
List of CurrentEnvironment objects describing the environment.

◆ GetDecisionSystem()

IDecisionSystem NPC.GetDecisionSystem ( )

Gets the decision system used by the NPC.

Returns
The decision system.

◆ LookAt()

void NPC.LookAt ( Transform  targetTransform)

Makes the NPC look at a specified target transform. Updates the NPC's rotation to face the target. If the target is null, resets the rotation to the previous value. Logs the action for debugging purposes.

Parameters
targetTransformThe transform of the target to look at. If null, the NPC resets its rotation.

◆ OnDestroy()

void NPC.OnDestroy ( )

Unsubscribes from the NPC event bus when the NPC is destroyed.

◆ OnInteraction()

void NPC.OnInteraction ( )

Called when Player starts interacting with NPC, see PlayerController::StartInteraction NPC will look at Player and StoppedDecision will be set to currentDecision

◆ Setup()

void NPC.Setup ( IDecisionSystem  decisionSystem,
string  modelId,
CharacterDTO  characterDTO 
)

Sets up the NPC's decision system, model, name, and system prompt. Initializes default memories.

Parameters
decisionSystemThe decision system to use.
modelIdThe model ID for LLM-based decision making.
characterDTOCharacter data

Member Data Documentation

◆ agent

NavMeshAgent NPC.agent

The NavMeshAgent component for navigation.

◆ HisBuilding

GameObject NPC.HisBuilding = null

The building associated with this NPC.

◆ Hunger

float NPC.Hunger = 0f

The hunger level of the NPC.

◆ speed

float NPC.speed = 3f

The movement speed of the NPC.

◆ StoppedDecision

IDecision NPC.StoppedDecision

Interrupted Decision, see OnInteraction

◆ Thirst

float NPC.Thirst = 0f

The thirst level of the NPC.

Property Documentation

◆ CharacterData

CharacterDTO NPC.CharacterData
get

The Character data generated by Narrator.

◆ EntityID

int NPC.EntityID
get

The unique entity ID of the NPC.

◆ ModelID

string NPC.ModelID = null
get

The model ID used for LLM-based decision making.

◆ NpcName

string NPC.NpcName = null
get

The name of the NPC.

◆ ObtainedMemories

List<ObtainedMemory> NPC.ObtainedMemories = new()
get

The list of memories obtained by the NPC.

◆ SystemPrompt

string NPC.SystemPrompt = null
getset

The system prompt used for LLM-based decision making.


The documentation for this class was generated from the following file: