vampires/Source/vampires/EnemyCharacter.cpp

44 lines
1.1 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "EnemyCharacter.h"
AEnemyCharacter::AEnemyCharacter(const FObjectInitializer& ObjectInitializer)
{
}
void AEnemyCharacter::BeginPlay()
{
Super::BeginPlay();
GetHealthComponent()->OnDamaged.BindUFunction(this, "OnDamaged");
GetHealthComponent()->OnDeath.BindUFunction(this, "OnDeath");
}
void AEnemyCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
UBehaviorTree* AEnemyCharacter::GetBehaviorTree()
{
return BehaviorTree;
}
void AEnemyCharacter::OnDamaged()
{
}
void AEnemyCharacter::OnDeath()
{
//if (IsValid(EXPPickupTemplate))
//{
FActorSpawnParameters actorSpawnParameters;
actorSpawnParameters.Owner = this;
actorSpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
actorSpawnParameters.TransformScaleMethod = ESpawnActorScaleMethod::MultiplyWithRoot;
GetWorld()->SpawnActor<AEXPPickup>(EXPPickupTemplate, GetActorLocation(), FRotator::ZeroRotator,
actorSpawnParameters);
//}
}