Skip to content

Commit

Permalink
Implemented AI guard class
Browse files Browse the repository at this point in the history
  • Loading branch information
Relrin committed Jan 3, 2018
1 parent 26729bd commit 884fc98
Show file tree
Hide file tree
Showing 25 changed files with 67 additions and 17 deletions.
Binary file added Content/Blueprints/BP_Guard.uasset
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Content/Maps/FirstPersonExampleMap.umap
Binary file not shown.
Binary file modified Content/Maps/FirstPersonExampleMap_BuiltData.uasset
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/FPSGame/FPSGame.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ public FPSGame(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "AIModule" });
}
}
34 changes: 34 additions & 0 deletions Source/FPSGame/Private/FPSAIGuard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "FPSAIGuard.h"
#include "Perception/PawnSensingComponent.h"

// Sets default values
AFPSAIGuard::AFPSAIGuard()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;

PawnSensingComponent = CreateDefaultSubobject<UPawnSensingComponent>(TEXT("PawnSensingComponent"));
PawnSensingComponent->OnSeePawn.AddDynamic(this, &AFPSAIGuard::OnPawnSeen);
}

// Called when the game starts or when spawned
void AFPSAIGuard::BeginPlay()
{
Super::BeginPlay();

}

void AFPSAIGuard::OnPawnSeen(APawn* Pawn)
{
if (Pawn == nullptr)
{
return;
}
}

// Called every frame
void AFPSAIGuard::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

}
2 changes: 0 additions & 2 deletions Source/FPSGame/Private/FPSBlackHole.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.

#include "FPSBlackHole.h"
#include "Components/SphereComponent.h"
#include "Components/StaticMeshComponent.h"
Expand Down
2 changes: 0 additions & 2 deletions Source/FPSGame/Private/FPSExtractionZone.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.

#include "FPSExtractionZone.h"
#include "Components/BoxComponent.h"
#include "Components/DecalComponent.h"
Expand Down
2 changes: 0 additions & 2 deletions Source/FPSGame/Private/FPSLaunchPad.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.

#include "FPSLaunchPad.h"
#include "Components/StaticMeshComponent.h"
#include "Components/BoxComponent.h"
Expand Down
2 changes: 0 additions & 2 deletions Source/FPSGame/Private/FPSObjectiveActor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.

#include "FPSObjectiveActor.h"
#include "Components/SphereComponent.h"
#include "Components/StaticMeshComponent.h"
Expand Down
32 changes: 32 additions & 0 deletions Source/FPSGame/Public/FPSAIGuard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "FPSAIGuard.generated.h"

class UPawnSensingComponent;

UCLASS()
class FPSGAME_API AFPSAIGuard : public ACharacter
{
GENERATED_BODY()

public:
// Sets default values for this character's properties
AFPSAIGuard();

protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;

UPROPERTY(VisibleAnywhere, Category = "Components")
UPawnSensingComponent* PawnSensingComponent;

UFUNCTION()
void OnPawnSeen(APawn* Pawn);


public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
2 changes: 0 additions & 2 deletions Source/FPSGame/Public/FPSBlackHole.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
Expand Down
2 changes: 0 additions & 2 deletions Source/FPSGame/Public/FPSExtractionZone.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
Expand Down
2 changes: 0 additions & 2 deletions Source/FPSGame/Public/FPSLaunchPad.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
Expand Down
2 changes: 0 additions & 2 deletions Source/FPSGame/Public/FPSObjectiveActor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
Expand Down

0 comments on commit 884fc98

Please sign in to comment.