16번 할 차례, 포스트프로세싱 하이라이팅까지 완료함.
This commit is contained in:
@@ -46,6 +46,7 @@ r.DynamicGlobalIlluminationMethod=1
|
||||
r.ReflectionMethod=1
|
||||
r.Shadow.Virtual.Enable=1
|
||||
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
|
||||
r.CustomDepth=3
|
||||
|
||||
[/Script/WorldPartitionEditor.WorldPartitionEditorSettings]
|
||||
CommandletClass=Class'/Script/UnrealEd.WorldPartitionConvertCommandlet'
|
||||
|
||||
BIN
Content/Blueprints/Character/Aura/ABP_Aura.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Character/Aura/ABP_Aura.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Character/Aura/BP_AuraCharacter.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Character/Aura/BP_AuraCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Character/BP_EnemyBase.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/Character/BP_EnemyBase.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/Character/Goblin_Slingshot/BP_Goblin_Slingshot.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Character/Goblin_Slingshot/BP_Goblin_Slingshot.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Character/Goblin_Spear/BP_Goblin_Spear.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Character/Goblin_Spear/BP_Goblin_Spear.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Game/BP_AuraGameMode.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/Game/BP_AuraGameMode.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Blueprints/Player/BP_AuraPlayerController.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Blueprints/Player/BP_AuraPlayerController.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Maps/StartupMap.umap
(Stored with Git LFS)
BIN
Content/Maps/StartupMap.umap
(Stored with Git LFS)
Binary file not shown.
@@ -8,7 +8,7 @@ public class Aura : ModuleRules
|
||||
{
|
||||
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
||||
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "EnhancedInput" });
|
||||
|
||||
PrivateDependencyModuleNames.AddRange(new string[] { });
|
||||
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
|
||||
#define CUSTOM_DEPTH_RED 250
|
||||
@@ -3,3 +3,16 @@
|
||||
|
||||
#include "Character/AuraCharacter.h"
|
||||
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
|
||||
AAuraCharacter::AAuraCharacter()
|
||||
{
|
||||
GetCharacterMovement()->bOrientRotationToMovement = true;
|
||||
GetCharacterMovement()->RotationRate = FRotator(0.f, 400.f, 0.f);
|
||||
GetCharacterMovement()->bConstrainToPlane = true;
|
||||
GetCharacterMovement()->bSnapToPlaneAtStart = true;
|
||||
|
||||
bUseControllerRotationPitch = false;
|
||||
bUseControllerRotationYaw = false;
|
||||
bUseControllerRotationRoll = false;
|
||||
}
|
||||
|
||||
@@ -3,3 +3,23 @@
|
||||
|
||||
#include "Character/AuraEnemy.h"
|
||||
|
||||
#include "Aura/Aura.h"
|
||||
|
||||
AAuraEnemy::AAuraEnemy()
|
||||
{
|
||||
GetMesh()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
|
||||
}
|
||||
|
||||
void AAuraEnemy::HighlightActor()
|
||||
{
|
||||
GetMesh()->SetRenderCustomDepth(true);
|
||||
GetMesh()->SetCustomDepthStencilValue(CUSTOM_DEPTH_RED);
|
||||
Weapon->SetRenderCustomDepth(true);
|
||||
Weapon->SetCustomDepthStencilValue(CUSTOM_DEPTH_RED);
|
||||
}
|
||||
|
||||
void AAuraEnemy::UnHighlightActor()
|
||||
{
|
||||
GetMesh()->SetRenderCustomDepth(false);
|
||||
Weapon->SetRenderCustomDepth(false);
|
||||
}
|
||||
|
||||
5
Source/Aura/Private/Game/AuraGameModeBase.cpp
Normal file
5
Source/Aura/Private/Game/AuraGameModeBase.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright HappyTanuki
|
||||
|
||||
|
||||
#include "Game/AuraGameModeBase.h"
|
||||
|
||||
6
Source/Aura/Private/Interaction/EnemyInterface.cpp
Normal file
6
Source/Aura/Private/Interaction/EnemyInterface.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
// Copyright HappyTanuki
|
||||
|
||||
|
||||
#include "Interaction/EnemyInterface.h"
|
||||
|
||||
// Add default functionality here for any IEnemyInterface functions that are not pure virtual.
|
||||
@@ -2,8 +2,106 @@
|
||||
|
||||
|
||||
#include "Player/AuraPlayerController.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "Interaction/EnemyInterface.h"
|
||||
|
||||
AAuraPlayerController::AAuraPlayerController()
|
||||
{
|
||||
bReplicates = true;
|
||||
}
|
||||
|
||||
void AAuraPlayerController::PlayerTick(float DeltaTime)
|
||||
{
|
||||
Super::PlayerTick(DeltaTime);
|
||||
|
||||
CursorTrace();
|
||||
}
|
||||
|
||||
void AAuraPlayerController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
check(AuraContext); //블루프린트에서 입력이 설정이 되지 않았다면 그대로 멈춘다 왜?:입력이 안 먹으면 안 되기 때문
|
||||
|
||||
UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
|
||||
check(Subsystem);
|
||||
|
||||
Subsystem->AddMappingContext(AuraContext, 0);
|
||||
|
||||
bShowMouseCursor = true;
|
||||
DefaultMouseCursor = EMouseCursor::Default;
|
||||
|
||||
FInputModeGameAndUI InputModeData;
|
||||
InputModeData.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock);
|
||||
InputModeData.SetHideCursorDuringCapture(false);
|
||||
SetInputMode(InputModeData);
|
||||
}
|
||||
|
||||
void AAuraPlayerController::SetupInputComponent()
|
||||
{
|
||||
Super::SetupInputComponent();
|
||||
|
||||
UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(InputComponent);
|
||||
|
||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AAuraPlayerController::Move);
|
||||
}
|
||||
|
||||
void AAuraPlayerController::Move(const FInputActionValue& InputActionvalue)
|
||||
{
|
||||
const FVector2d InputAxisVector = InputActionvalue.Get<FVector2d>();
|
||||
const FRotator Ratation = GetControlRotation();
|
||||
const FRotator YawRotation(0.f, Ratation.Yaw, 0.f);
|
||||
|
||||
const FVector ForwardDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
|
||||
const FVector RightDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
|
||||
|
||||
if (APawn* ControlledPawn = GetPawn<APawn>())
|
||||
{
|
||||
ControlledPawn->AddMovementInput(ForwardDirection, InputAxisVector.Y);
|
||||
ControlledPawn->AddMovementInput(RightDirection, InputAxisVector.X);
|
||||
}
|
||||
}
|
||||
|
||||
void AAuraPlayerController::CursorTrace()
|
||||
{
|
||||
FHitResult CursorHit;
|
||||
GetHitResultUnderCursor(ECC_Visibility, false, CursorHit);
|
||||
if (!CursorHit.bBlockingHit) return;
|
||||
|
||||
LastActor = ThisActor;
|
||||
ThisActor = CursorHit.GetActor(); //자동 캐스팅됨, Cast<IEnemyInterface>()생략됨.
|
||||
|
||||
/**
|
||||
* 각 상황에 따른 분류:
|
||||
* A. LastActor == nullptr && ThisActor == nullptr
|
||||
* - NOP
|
||||
* B. LastActor == nullptr && ThisActor != nullptr
|
||||
* - ThisActor 하이라이팅하기
|
||||
* C. LastActor != nullptr && ThisActor == nullptr
|
||||
* - LastActor 하이라이트 끄기
|
||||
* D. LastActor != nullptr && ThisActor != nullptr && LastActor != ThisActor
|
||||
* - LastActor 하이라이트 끄고 ThisActor 하이라이팅하기
|
||||
* E. LastActor != nullptr && ThisActor != nullptr && LastActor == ThisActor
|
||||
* - NOP
|
||||
**/
|
||||
if (LastActor == nullptr)
|
||||
{
|
||||
if (ThisActor == nullptr) return; //A
|
||||
ThisActor->HighlightActor(); //B
|
||||
}
|
||||
else if (ThisActor == nullptr)
|
||||
{
|
||||
//C
|
||||
LastActor->UnHighlightActor();
|
||||
}
|
||||
else if (LastActor != ThisActor)
|
||||
{
|
||||
//D
|
||||
LastActor->UnHighlightActor();
|
||||
ThisActor->HighlightActor();
|
||||
}
|
||||
else
|
||||
{
|
||||
//E
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,5 +13,6 @@ UCLASS()
|
||||
class AURA_API AAuraCharacter : public AAuraCharacterBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AAuraCharacter();
|
||||
};
|
||||
|
||||
@@ -4,14 +4,19 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Character/AuraCharacterBase.h"
|
||||
#include "Interaction/EnemyInterface.h"
|
||||
#include "AuraEnemy.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API AAuraEnemy : public AAuraCharacterBase
|
||||
class AURA_API AAuraEnemy : public AAuraCharacterBase, public IEnemyInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
AAuraEnemy();
|
||||
|
||||
virtual void HighlightActor() override;
|
||||
virtual void UnHighlightActor() override;
|
||||
};
|
||||
|
||||
17
Source/Aura/Public/Game/AuraGameModeBase.h
Normal file
17
Source/Aura/Public/Game/AuraGameModeBase.h
Normal file
@@ -0,0 +1,17 @@
|
||||
// Copyright HappyTanuki
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "AuraGameModeBase.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class AURA_API AAuraGameModeBase : public AGameModeBase
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
||||
27
Source/Aura/Public/Interaction/EnemyInterface.h
Normal file
27
Source/Aura/Public/Interaction/EnemyInterface.h
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright HappyTanuki
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/Interface.h"
|
||||
#include "EnemyInterface.generated.h"
|
||||
|
||||
// This class does not need to be modified.
|
||||
UINTERFACE(MinimalAPI)
|
||||
class UEnemyInterface : public UInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class AURA_API IEnemyInterface
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// Add interface functions to this class. This is the class that will be inherited to implement this interface.
|
||||
public:
|
||||
virtual void HighlightActor() = 0;
|
||||
virtual void UnHighlightActor() = 0;
|
||||
};
|
||||
@@ -6,6 +6,11 @@
|
||||
#include "GameFramework/PlayerController.h"
|
||||
#include "AuraPlayerController.generated.h"
|
||||
|
||||
class UInputMappingContext;
|
||||
class UInputAction;
|
||||
struct FInputActionValue;
|
||||
class IEnemyInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -15,6 +20,22 @@ class AURA_API AAuraPlayerController : public APlayerController
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
AAuraPlayerController();
|
||||
|
||||
virtual void PlayerTick(float DeltaTime) override;
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
virtual void SetupInputComponent() override;
|
||||
private:
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TObjectPtr<UInputMappingContext> AuraContext;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Input")
|
||||
TObjectPtr<UInputAction> MoveAction;
|
||||
|
||||
void Move(const FInputActionValue& InputActionvalue);
|
||||
|
||||
void CursorTrace();
|
||||
TScriptInterface<IEnemyInterface> LastActor;
|
||||
TScriptInterface<IEnemyInterface> ThisActor;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user