setup npc visuals

This commit is contained in:
2026-06-03 15:12:04 +03:00
parent f6608c5f9a
commit 00fe452168
34 changed files with 142 additions and 38 deletions
+23 -5
View File
@@ -7,6 +7,7 @@
#include "NPCTypeDefinition.h"
#include "NPCAIController.h"
#include "NPCTargetLocation.h"
#include "NPCVisualsConfig.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "Components/SkeletalMeshComponent.h"
#include "GameFramework/CharacterMovementComponent.h"
@@ -33,22 +34,22 @@ ANPC::ANPC()
ENPCType ANPC::GetNPCType() const
{
return NPCTypeDefinition ? NPCTypeDefinition->Type : ENPCType::Walker;
return TypeDefinition ? TypeDefinition->Type : ENPCType::Walker;
}
float ANPC::GetObservationWeight() const
{
return NPCTypeDefinition ? NPCTypeDefinition->ObservationWeight : 1.0f;
return TypeDefinition ? TypeDefinition->ObservationWeight : 1.0f;
}
bool ANPC::ShouldStopToObserve() const
{
return NPCTypeDefinition ? NPCTypeDefinition->bStopsToObserve : false;
return TypeDefinition ? TypeDefinition->bStopsToObserve : false;
}
float ANPC::GetObserveDuration() const
{
return NPCTypeDefinition ? NPCTypeDefinition->ObserveDurationSeconds : 0.0f;
return TypeDefinition ? TypeDefinition->ObserveDurationSeconds : 0.0f;
}
void ANPC::ActivateFromPool(const FVector& Location, const FRotator& Rotation)
@@ -97,4 +98,21 @@ void ANPC::DeactivateToPool()
SetActorHiddenInGame(true);
SetActorEnableCollision(false);
}
}
void ANPC::Init(ENPCType InType)
{
if (InType == ENPCType::None)
return;
Type = InType;
if (!NPCTypeDefinitions.Contains(Type))
return;
UNPCTypeDefinition* Definition = NPCTypeDefinitions[Type];
if (!Definition)
return;
TypeDefinition = Definition;
}