// Fill out your copyright notice in the Description page of Project Settings.
#include "ShooterAIController.h"
#include "Kismet\GameplayStatics.h"
void AShooterAIController::BeginPlay()
{
Super::BeginPlay();
APawn* PlayerPawn= UGameplayStatics::GetPlayerPawn(GetWorld(),0);
SetFocus(PlayerPawn);
MoveToActor(PlayerPawn,200);
}
/ *特定の優先度にフォーカスアクターを設定し、結果としてFocalPointを設定します。 * /
/* Set Focus actor for given priority, will set FocalPoint as a result. */
virtual void SetFocus(AActor* NewFocus, EAIFocusPriority::Type InPriority = EAIFocusPriority::Gameplay);
protected:
/** Overridable native event for when play begins for this actor. */
virtual void BeginPlay();
をコピーして
ShooterAIController.hにペーストしてオーバーライドします
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AIController.h"
#include "ShooterAIController.generated.h"
/**
*
*/
UCLASS()
class SIMPLESHOOTERCP2_API AShooterAIController : public AAIController
{
GENERATED_BODY()
protected:
virtual void BeginPlay() override;
};
// Fill out your copyright notice in the Description page of Project Settings.
#include "ShooterAIController.h"
#include "Kismet\GameplayStatics.h"
void AShooterAIController::BeginPlay()
{
Super::BeginPlay();
APawn* PlayerPawn= UGameplayStatics::GetPlayerPawn(GetWorld(),0);
SetFocus(PlayerPawn);
}