Add minion character & CAIController
This commit is contained in:
@@ -91,3 +91,6 @@ ConnectionType=USBOnly
|
|||||||
bUseManualIPAddress=False
|
bUseManualIPAddress=False
|
||||||
ManualIPAddress=
|
ManualIPAddress=
|
||||||
|
|
||||||
|
[/Script/GameplayDebugger.GameplayDebuggerConfig]
|
||||||
|
CategorySlot5=Five
|
||||||
|
|
||||||
|
|||||||
BIN
Content/AI/Minions/AIC_Minion_BP.uasset
LFS
Normal file
BIN
Content/AI/Minions/AIC_Minion_BP.uasset
LFS
Normal file
Binary file not shown.
BIN
Content/AI/Minions/Minion_BP.uasset
LFS
Normal file
BIN
Content/AI/Minions/Minion_BP.uasset
LFS
Normal file
Binary file not shown.
BIN
Content/Maps/GameLevel.umap
LFS
BIN
Content/Maps/GameLevel.umap
LFS
Binary file not shown.
48
Source/Crunch/Private/AI/CAIController.cpp
Normal file
48
Source/Crunch/Private/AI/CAIController.cpp
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
// Multiplayer By Caleb
|
||||||
|
|
||||||
|
|
||||||
|
#include "AI/CAIController.h"
|
||||||
|
|
||||||
|
#include "Character/CCharacter.h"
|
||||||
|
#include "Perception/AIPerceptionComponent.h"
|
||||||
|
#include "Perception/AISenseConfig_Sight.h"
|
||||||
|
|
||||||
|
|
||||||
|
ACAIController::ACAIController()
|
||||||
|
{
|
||||||
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
|
AIPerceptionComponent = CreateDefaultSubobject<UAIPerceptionComponent>("AI Perception Component");
|
||||||
|
SightConfig = CreateDefaultSubobject<UAISenseConfig_Sight>("Sight config");
|
||||||
|
|
||||||
|
SightConfig->DetectionByAffiliation.bDetectEnemies = true;
|
||||||
|
SightConfig->DetectionByAffiliation.bDetectFriendlies = false;
|
||||||
|
SightConfig->DetectionByAffiliation.bDetectNeutrals = false;
|
||||||
|
|
||||||
|
SightConfig->SightRadius = 1000.f;
|
||||||
|
SightConfig->LoseSightRadius = 1200.f;
|
||||||
|
SightConfig->SetMaxAge(5.f);
|
||||||
|
SightConfig->PeripheralVisionAngleDegrees = 100.f;
|
||||||
|
|
||||||
|
AIPerceptionComponent->ConfigureSense(*SightConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACAIController::OnPossess(APawn* InPawn)
|
||||||
|
{
|
||||||
|
Super::OnPossess(InPawn);
|
||||||
|
SetGenericTeamId(FGenericTeamId(0));
|
||||||
|
|
||||||
|
if (const auto PawnTeamInterface{Cast<IGenericTeamAgentInterface>(InPawn)})
|
||||||
|
{
|
||||||
|
PawnTeamInterface->SetGenericTeamId(GetGenericTeamId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACAIController::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ACAIController::Tick(float DeltaTime)
|
||||||
|
{
|
||||||
|
Super::Tick(DeltaTime);
|
||||||
|
}
|
||||||
30
Source/Crunch/Public/AI/CAIController.h
Normal file
30
Source/Crunch/Public/AI/CAIController.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
// Multiplayer By Caleb
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "AIController.h"
|
||||||
|
#include "CAIController.generated.h"
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class CRUNCH_API ACAIController : public AAIController
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
ACAIController();
|
||||||
|
virtual void OnPossess(APawn* InPawn) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
UPROPERTY(VisibleDefaultsOnly, Category="Perception")
|
||||||
|
UAIPerceptionComponent* AIPerceptionComponent;
|
||||||
|
|
||||||
|
UPROPERTY(VisibleDefaultsOnly, Category="Perception")
|
||||||
|
class UAISenseConfig_Sight* SightConfig;
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user