Smooth MoveTo Player
This commit is contained in:
parent
7f693b9155
commit
addeb47c04
BIN
Content/Enemy/BP_AIController.uasset (Stored with Git LFS)
BIN
Content/Enemy/BP_AIController.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/BP_EnemyCharacter.uasset (Stored with Git LFS)
BIN
Content/Enemy/BP_EnemyCharacter.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/BT_Enemy.uasset (Stored with Git LFS)
BIN
Content/Enemy/BT_Enemy.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Levels/Level.umap (Stored with Git LFS)
BIN
Content/Levels/Level.umap (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
|
@ -17,6 +17,7 @@ AVampireAIController::AVampireAIController(const FObjectInitializer& object_init
|
|||
void AVampireAIController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
GetWorldTimerManager().SetTimer(PawnMoveToTimerHandle, this, &AVampireAIController::PawnMoveTo, 0.25f, true);
|
||||
}
|
||||
|
||||
void AVampireAIController::Tick(float DeltaTime)
|
||||
|
@ -69,6 +70,12 @@ void AVampireAIController::OnDeath(FDamageInfo info)
|
|||
characterMovementComponent->StopActiveMovement();
|
||||
characterMovementComponent->SetComponentTickEnabled(false);
|
||||
}
|
||||
GetWorldTimerManager().ClearTimer(PawnMoveToTimerHandle);
|
||||
|
||||
EnemyCharacter->SetLifeSpan(0.1f);
|
||||
}
|
||||
|
||||
void AVampireAIController::PawnMoveTo()
|
||||
{
|
||||
MoveToActor(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0), 5);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ private:
|
|||
|
||||
AEnemyCharacter* EnemyCharacter;
|
||||
|
||||
FTimerHandle PawnMoveToTimerHandle;
|
||||
|
||||
public:
|
||||
AVampireAIController(const FObjectInitializer& object_initializer);
|
||||
|
||||
|
@ -45,4 +47,8 @@ public:
|
|||
|
||||
UFUNCTION()
|
||||
virtual void OnDeath(FDamageInfo info);
|
||||
|
||||
private:
|
||||
UFUNCTION()
|
||||
virtual void PawnMoveTo();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue