setup npc visuals
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user