13. "Highlight Enemies"

This commit is contained in:
2024-04-12 22:05:09 -04:00
parent 842ae8a32a
commit 4c358ca5c9
18 changed files with 327 additions and 12 deletions

View File

@ -1,12 +1,14 @@
#include "GasaCharacter.h"
#include "Camera/CameraComponent.h"
#include "Components/CapsuleComponent.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "Kismet/KismetSystemLibrary.h"
void AGasaCharacter::SetHighlight(EHighlight desired)
void AGasaCharacter::SetHighlight(EHighlight Desired)
{
HighlightState = Desired;
}
AGasaCharacter::AGasaCharacter()
@ -48,3 +50,29 @@ void AGasaCharacter::BeginPlay()
{
Super::BeginPlay();
}
void AGasaCharacter::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
switch (HighlightState)
{
case EHighlight::Disabled:
break;
case EHighlight::Enabled:
{
UCapsuleComponent* Capsule = GetCapsuleComponent();
UKismetSystemLibrary::DrawDebugCapsule(this
, Capsule->GetComponentLocation()
, Capsule->GetScaledCapsuleHalfHeight()
, Capsule->GetScaledCapsuleRadius()
, Capsule->GetComponentRotation()
, FLinearColor(0.8, 0.32, 0.05f, 1.f)
, 0.f
, 1.f
);
}
break;
}
}

View File

@ -5,6 +5,13 @@
#include "GasaCharacter.generated.h"
UENUM(BlueprintType)
enum class EHighlight : uint8
{
Disabled,
Enabled,
};
UCLASS(Abstract)
class GASA_API AGasaCharacter : public ACharacter
{
@ -25,10 +32,11 @@ public:
// This will be implemented in the base until it needs to be lifted into an abstraction.
#pragma region Highlighting
void SetHighlight( EHighlight desired );
EHighlight HighlightState;
void SetHighlight( EHighlight Desired );
UFUNCTION(BlueprintCallable)
FORCEINLINE void Highlight() { SetHighlight(EHighlight::Disabled); };
FORCEINLINE void Highlight() { SetHighlight(EHighlight::Enabled); };
UFUNCTION(BlueprintCallable)
FORCEINLINE void Dehighlight() { SetHighlight(EHighlight::Disabled); };
@ -38,5 +46,7 @@ public:
#pragma region Actor
void BeginPlay() override;
void Tick(float DeltaSeconds) override;
#pragma endregion Actor
};

View File

@ -1 +1,6 @@
#include "PlayerCharacter.h"
#include "PlayerCharacter.h"
APlayerCharacter::APlayerCharacter()
{
PrimaryActorTick.bCanEverTick = true;
}

View File

@ -10,5 +10,5 @@ class GASA_API APlayerCharacter : public AGasaCharacter
GENERATED_BODY()
public:
APlayerCharacter();
};