-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemyAI.cpp
More file actions
49 lines (34 loc) · 789 Bytes
/
EnemyAI.cpp
File metadata and controls
49 lines (34 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Fill out your copyright notice in the Description page of Project Settings.
#include "EnemyAI.h"
#include "Kismet/GameplayStatics.h"
AEnemyAI::AEnemyAI()
{
}
void AEnemyAI::OnPossess(APawn* InPawn)
{
}
void AEnemyAI::BeginPlay()
{
Super::BeginPlay();;
PlayerPawn = UGameplayStatics::GetPlayerPawn(this, 0);
if(PlayerPawn == nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("Player Pawn is not found"));
}
else
{
UE_LOG(LogTemp, Warning, TEXT("%s"), *PlayerPawn->GetName());
}
ChasePlayer();
}
void AEnemyAI::ChasePlayer()
{
//UE_LOG(LogTemp, Log, );
}
void AEnemyAI::Tick(float DeltaTime)
{
if (PlayerPawn) // 플레이어가 보이는 범위 내에 있는지 확인합니다.
{
MoveToActor(PlayerPawn); // 플레이어 폰을 향해 이동합니다.
}
}