funny-prince/Source/FunnyPrince/FighterAIController.cpp

37 lines
757 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "FighterAIController.h"
#include "FunnyPrinceCharacter.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "Kismet/GameplayStatics.h"
void AFighterAIController::BeginPlay()
{
Super::BeginPlay();
if (AIBehavior)
{
RunBehaviorTree(AIBehavior);
GetBlackboardComponent()->SetValueAsVector(TEXT("StartLocation"), GetPawn()->GetActorLocation());
}
}
void AFighterAIController::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
}
bool AFighterAIController::IsDead() const
{
AFunnyPrinceCharacter* ControlledCharacter = Cast<AFunnyPrinceCharacter>(GetPawn());
if (ControlledCharacter)
{
return ControlledCharacter->IsDead();
}
return true;
}