Compare commits
No commits in common. "adfe961cefe2cb684a2acff3dbf22d02cd063fd1" and "fef6bd8e3e60832ec356fdd52552689dfe0f9a48" have entirely different histories.
adfe961cef
...
fef6bd8e3e
@ -2,7 +2,7 @@
|
|||||||
bEnabled=False
|
bEnabled=False
|
||||||
Startup=AutomaticButHidden
|
Startup=AutomaticButHidden
|
||||||
bEnableReinstancing=True
|
bEnableReinstancing=True
|
||||||
bAutomaticallyCompileNewClasses=False
|
bAutomaticallyCompileNewClasses=True
|
||||||
bPreloadEngineModules=False
|
bPreloadEngineModules=False
|
||||||
bPreloadEnginePluginModules=False
|
bPreloadEnginePluginModules=False
|
||||||
bPreloadProjectModules=True
|
bPreloadProjectModules=True
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
// Copyright; GhostPacket Games
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -3,12 +3,3 @@
|
|||||||
|
|
||||||
#include "Character/AuraEnemy.h"
|
#include "Character/AuraEnemy.h"
|
||||||
|
|
||||||
void AAuraEnemy::HighlightActor()
|
|
||||||
{
|
|
||||||
bHighlighted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AAuraEnemy::UnHighlightActor()
|
|
||||||
{
|
|
||||||
bHighlighted = false;
|
|
||||||
}
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
// Copyright; GhostPacket Games
|
|
||||||
|
|
||||||
|
|
||||||
#include "Interaction/EnemyInterface.h"
|
|
||||||
|
|
||||||
// Add default functionality here for any IEnemyInterface functions that are not pure virtual.
|
|
@ -5,75 +5,12 @@
|
|||||||
|
|
||||||
#include "EnhancedInputSubsystems.h"
|
#include "EnhancedInputSubsystems.h"
|
||||||
#include "EnhancedInputComponent.h"
|
#include "EnhancedInputComponent.h"
|
||||||
#include "Interaction/EnemyInterface.h"
|
|
||||||
|
|
||||||
AAuraPlayerController::AAuraPlayerController()
|
AAuraPlayerController::AAuraPlayerController()
|
||||||
{
|
{
|
||||||
bReplicates = true;
|
bReplicates = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AAuraPlayerController::PlayerTick(float DeltaTime)
|
|
||||||
{
|
|
||||||
Super::PlayerTick(DeltaTime);
|
|
||||||
|
|
||||||
CursorTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AAuraPlayerController::CursorTrace()
|
|
||||||
{
|
|
||||||
FHitResult CursorHit;
|
|
||||||
GetHitResultUnderCursor(ECC_Visibility, false, CursorHit);
|
|
||||||
if (!CursorHit.bBlockingHit)
|
|
||||||
return;
|
|
||||||
|
|
||||||
LastActor = ThisActor;
|
|
||||||
ThisActor = CursorHit.GetActor();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Line tracer from cursor. There are several scenarios:
|
|
||||||
* A. LastActor is null && ThisActor is null
|
|
||||||
* - Do nothing.
|
|
||||||
* B. LastActor is null && ThisActor is valid
|
|
||||||
* - Highlight ThisActor.
|
|
||||||
* C. LastActor is valid && ThisActor is null
|
|
||||||
* - UnHighlight LastActor
|
|
||||||
* D. Both actors are valid, but LastActor != ThisActor
|
|
||||||
* - UnHighlight LastActor.
|
|
||||||
* - Highlight ThisActor.
|
|
||||||
* E. Both actors are valid, and are the same actor
|
|
||||||
* - Do nothing.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!LastActor)
|
|
||||||
{
|
|
||||||
if (ThisActor)
|
|
||||||
{
|
|
||||||
// Case B
|
|
||||||
ThisActor->HighlightActor();
|
|
||||||
}
|
|
||||||
// else Case A
|
|
||||||
}
|
|
||||||
else // LastActor is valid
|
|
||||||
{
|
|
||||||
if (!ThisActor)
|
|
||||||
{
|
|
||||||
// Case C
|
|
||||||
LastActor->UnHighlightActor();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Both Actors are valid
|
|
||||||
if (LastActor != ThisActor)
|
|
||||||
{
|
|
||||||
// Case D
|
|
||||||
LastActor->UnHighlightActor();
|
|
||||||
ThisActor->HighlightActor();
|
|
||||||
}
|
|
||||||
// else do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AAuraPlayerController::BeginPlay()
|
void AAuraPlayerController::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
@ -115,4 +52,4 @@ void AAuraPlayerController::Move(const FInputActionValue& InputActionValue)
|
|||||||
|
|
||||||
ControlledPawn->AddMovementInput(ForwardDirection, InputAxisVector.Y);
|
ControlledPawn->AddMovementInput(ForwardDirection, InputAxisVector.Y);
|
||||||
ControlledPawn->AddMovementInput(RightDirection, InputAxisVector.X);
|
ControlledPawn->AddMovementInput(RightDirection, InputAxisVector.X);
|
||||||
}
|
}
|
||||||
|
@ -4,21 +4,14 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Character/AuraCharacterBase.h"
|
#include "Character/AuraCharacterBase.h"
|
||||||
#include "Interaction/EnemyInterface.h"
|
|
||||||
#include "AuraEnemy.generated.h"
|
#include "AuraEnemy.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class AURA_API AAuraEnemy : public AAuraCharacterBase, public IEnemyInterface
|
class AURA_API AAuraEnemy : public AAuraCharacterBase
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void HighlightActor() override;
|
|
||||||
virtual void UnHighlightActor() override;
|
|
||||||
|
|
||||||
UPROPERTY (BlueprintReadOnly)
|
|
||||||
bool bHighlighted = false;
|
|
||||||
};
|
};
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Copyright; GhostPacket Games
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "UObject/Interface.h"
|
|
||||||
#include "EnemyInterface.generated.h"
|
|
||||||
|
|
||||||
UINTERFACE(MinimalAPI)
|
|
||||||
class UEnemyInterface : public UInterface
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
};
|
|
||||||
|
|
||||||
class AURA_API IEnemyInterface
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void HighlightActor () = 0; // pure virtual function
|
|
||||||
virtual void UnHighlightActor () = 0;
|
|
||||||
};
|
|
@ -9,8 +9,6 @@
|
|||||||
class UInputMappingContext;
|
class UInputMappingContext;
|
||||||
class UInputAction;
|
class UInputAction;
|
||||||
|
|
||||||
class IEnemyInterface;
|
|
||||||
|
|
||||||
struct FInputActionValue;
|
struct FInputActionValue;
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
@ -20,7 +18,6 @@ class AURA_API AAuraPlayerController : public APlayerController
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AAuraPlayerController ();
|
AAuraPlayerController ();
|
||||||
virtual void PlayerTick(float DeltaTime) override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
@ -34,10 +31,4 @@ private:
|
|||||||
TObjectPtr<UInputAction> MoveAction;
|
TObjectPtr<UInputAction> MoveAction;
|
||||||
|
|
||||||
void Move (const FInputActionValue &InputActionValue);
|
void Move (const FInputActionValue &InputActionValue);
|
||||||
|
|
||||||
void CursorTrace ();
|
|
||||||
|
|
||||||
// for highlighting
|
|
||||||
TScriptInterface<IEnemyInterface> LastActor; // TScriptInterface must be used to hold interfaces
|
|
||||||
TScriptInterface<IEnemyInterface> ThisActor;
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user