13. "Highlight Enemies"
This commit is contained in:
parent
9a8029c365
commit
0a6bbf1482
Binary file not shown.
Binary file not shown.
BIN
Project/Content/Core/Game/BP_GameMode.uasset
(Stored with Git LFS)
BIN
Project/Content/Core/Game/BP_GameMode.uasset
(Stored with Git LFS)
Binary file not shown.
3
Project/Saved/Config/ConsoleHistory.ini
Normal file
3
Project/Saved/Config/ConsoleHistory.ini
Normal file
@ -0,0 +1,3 @@
|
||||
[ConsoleHistory]
|
||||
History=Cog.ToggleInput
|
||||
|
29
Project/Saved/ImGui/imgui.ini
Normal file
29
Project/Saved/ImGui/imgui.ini
Normal file
@ -0,0 +1,29 @@
|
||||
[Window][DockSpaceViewport_11111111]
|
||||
Pos=0,0
|
||||
Size=1614,1271
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][Inspector##Inspector]
|
||||
Pos=910,136
|
||||
Size=641,1061
|
||||
Collapsed=1
|
||||
|
||||
[Table][0x7E0CA29E,2]
|
||||
Column 0 Weight=1.0000
|
||||
Column 1 Weight=1.0000
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x8B93E3BD Window=0xA787BDB4 Pos=0,0 Size=1614,1271 CentralNode=1
|
||||
|
||||
[Cog][Windows]
|
||||
0xD0F6B9F9
|
||||
|
||||
[Cog][Widgets]
|
||||
0x348EE4A5 0
|
||||
0x63A19979 0
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -1 +1,6 @@
|
||||
#include "PlayerCharacter.h"
|
||||
|
||||
APlayerCharacter::APlayerCharacter()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
}
|
||||
|
@ -10,5 +10,5 @@ class GASA_API APlayerCharacter : public AGasaCharacter
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
|
||||
APlayerCharacter();
|
||||
};
|
||||
|
@ -10,6 +10,8 @@ public class Gasa : ModuleRules
|
||||
{
|
||||
public Gasa(ReadOnlyTargetRules Target) : base(Target)
|
||||
{
|
||||
bUseUnity = false;
|
||||
|
||||
#region Engine
|
||||
PrivateIncludePathModuleNames.AddRange(new string[] {
|
||||
"Core",
|
||||
@ -29,12 +31,18 @@ public class Gasa : ModuleRules
|
||||
"InputCore",
|
||||
"NetCore",
|
||||
"Niagara",
|
||||
"UMG",
|
||||
});
|
||||
#endregion Engine
|
||||
|
||||
#region Plugins
|
||||
if (Target.Configuration != UnrealTargetConfiguration.Shipping && Target.Type != TargetRules.TargetType.Server)
|
||||
{
|
||||
PrivateDefinitions.AddRange(new string[]
|
||||
{
|
||||
"ENABLE_COG=true",
|
||||
});
|
||||
|
||||
PrivateIncludePathModuleNames.AddRange( new string[]
|
||||
{
|
||||
"CogCommon",
|
||||
|
@ -2,15 +2,21 @@
|
||||
#include "CoreMinimal.h"
|
||||
// #define private protected
|
||||
|
||||
UENUM(BlueprintType)
|
||||
enum class EHighlight
|
||||
{
|
||||
Disabled,
|
||||
Enabled,
|
||||
};
|
||||
#include "CogCommon.h"
|
||||
|
||||
#pragma region Engine Forwards
|
||||
class UCameraComponent;
|
||||
class UInputAction;
|
||||
struct FInputActionValue;
|
||||
class UInputMappingContext;
|
||||
class USpringArmComponent;
|
||||
#pragma endregion Engine Forwards
|
||||
|
||||
#pragma region Engine Plugin Forwards
|
||||
class UCogWindowManager;
|
||||
#pragma endregion Engine Plugin Forwards
|
||||
|
||||
#pragma region Gasa Forwards
|
||||
class AGasaCharacter;
|
||||
#pragma endregion Gasa Forwards
|
||||
|
||||
|
34
Project/Source/Gasa/GasaGameState.cpp
Normal file
34
Project/Source/Gasa/GasaGameState.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "GasaGameState.h"
|
||||
|
||||
#include "CogAll.h"
|
||||
#include "CogWindowManager.h"
|
||||
|
||||
AGasaGameState::AGasaGameState()
|
||||
{
|
||||
// Enable ticking
|
||||
PrimaryActorTick.bCanEverTick = true;
|
||||
PrimaryActorTick.SetTickFunctionEnable(true);
|
||||
PrimaryActorTick.bStartWithTickEnabled = true;
|
||||
}
|
||||
|
||||
#pragma region GameState
|
||||
void AGasaGameState::BeginPlay()
|
||||
{
|
||||
#if ENABLE_COG
|
||||
CogWindowManager = NewObject<UCogWindowManager>(this);
|
||||
CogWindowManagerRef = CogWindowManager;
|
||||
|
||||
// Add all the built-in windows
|
||||
Cog::AddAllWindows(*CogWindowManager);
|
||||
#endif //ENABLE_COG
|
||||
}
|
||||
|
||||
void AGasaGameState::Tick(float DeltaSeconds)
|
||||
{
|
||||
Super::Tick(DeltaSeconds);
|
||||
|
||||
#if ENABLE_COG
|
||||
CogWindowManager->Tick(DeltaSeconds);
|
||||
#endif //ENABLE_COG
|
||||
}
|
||||
#pragma endregion GameState
|
30
Project/Source/Gasa/GasaGameState.h
Normal file
30
Project/Source/Gasa/GasaGameState.h
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "GameFramework/GameState.h"
|
||||
#include "GasaCommon.h"
|
||||
|
||||
#include "GasaGameState.generated.h"
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class GASA_API AGasaGameState : public AGameState
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
#pragma region Cog
|
||||
// To make sure it doesn't get garbage collected.
|
||||
UPROPERTY()
|
||||
TObjectPtr<UObject> CogWindowManagerRef = nullptr;
|
||||
|
||||
#if ENABLE_COG
|
||||
TObjectPtr<UCogWindowManager> CogWindowManager = nullptr;
|
||||
#endif // ENABLE_COG
|
||||
#pragma endregion Cog
|
||||
|
||||
AGasaGameState();
|
||||
|
||||
#pragma region GameState
|
||||
void BeginPlay() override;
|
||||
|
||||
void Tick(float DeltaSeconds) override;
|
||||
#pragma endregion GameState
|
||||
};
|
@ -3,6 +3,7 @@
|
||||
#include "Engine/LocalPlayer.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "Character/GasaCharacter.h"
|
||||
|
||||
AGasaPlayerController::AGasaPlayerController()
|
||||
{
|
||||
@ -53,6 +54,44 @@ void AGasaPlayerController::Move(FInputActionValue const& ActionValue)
|
||||
}
|
||||
|
||||
#pragma region PlayerController
|
||||
void AGasaPlayerController::PlayerTick(float DeltaTime)
|
||||
{
|
||||
Super::PlayerTick(DeltaTime);
|
||||
|
||||
// Cursor Trace
|
||||
for (int32 do_once = 0; do_once != 1; ++ do_once)
|
||||
{
|
||||
FHitResult CursorHit;
|
||||
GetHitResultUnderCursor(ECC_Pawn, false, CursorHit);
|
||||
if (! CursorHit.bBlockingHit)
|
||||
break;
|
||||
|
||||
HoverPrev = HoverCurr;
|
||||
HoverCurr = Cast<AGasaCharacter>(CursorHit.GetActor());
|
||||
if (HoverPrev == nullptr)
|
||||
{
|
||||
// We didn't have a prev to de-highlight so we just need to highlight newly detected character.
|
||||
if (HoverCurr)
|
||||
HoverCurr->Highlight();
|
||||
|
||||
// No matter what we need to not go to the next case as there is no previous.
|
||||
break;
|
||||
}
|
||||
//else Previous is valid...
|
||||
|
||||
// We are no longer hovering the previous with no new character, we just need to de-highlight previous.
|
||||
if ( HoverCurr == nullptr )
|
||||
HoverPrev->Dehighlight();
|
||||
|
||||
// We had a prev and curr change between frames. They both don't match; we need to switch highlighting.
|
||||
else if ( HoverPrev != HoverCurr )
|
||||
{
|
||||
HoverPrev->Dehighlight();
|
||||
HoverCurr->Highlight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AGasaPlayerController::SetupInputComponent()
|
||||
{
|
||||
Super::SetupInputComponent();
|
||||
|
@ -13,6 +13,12 @@ class GASA_API AGasaPlayerController : public APlayerController
|
||||
public:
|
||||
|
||||
#pragma region Input
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
AGasaCharacter* HoverPrev;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
|
||||
AGasaCharacter* HoverCurr;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category="Input")
|
||||
TObjectPtr<UInputMappingContext> IMC;
|
||||
|
||||
@ -25,6 +31,8 @@ public:
|
||||
void Move(FInputActionValue const& ActionValue);
|
||||
|
||||
#pragma region PlayerController
|
||||
void PlayerTick(float DeltaTime) override;
|
||||
|
||||
void SetupInputComponent() override;
|
||||
#pragma endregion PlayerController
|
||||
|
||||
|
0
Project/Source/Gasa/GasaViewport.cpp
Normal file
0
Project/Source/Gasa/GasaViewport.cpp
Normal file
15
Project/Source/Gasa/GasaViewport.h
Normal file
15
Project/Source/Gasa/GasaViewport.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "Blueprint/GameViewportSubsystem.h"
|
||||
|
||||
#include "GasaViewport.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class GASA_API UGasaViewportSubsystem : public UGameViewportSubsystem
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
// UGasaViewportSubsystem();
|
||||
|
||||
|
||||
};
|
@ -11,6 +11,8 @@ public class GasaEditorTarget : TargetRules
|
||||
|
||||
DefaultBuildSettings = BuildSettingsVersion.Latest;
|
||||
|
||||
bUseUnityBuild = false;
|
||||
|
||||
ExtraModuleNames.Add("Gasa");
|
||||
ExtraModuleNames.Add("GasaEditor");
|
||||
}
|
||||
|
98
scripts/build_project.ps1
Normal file
98
scripts/build_project.ps1
Normal file
@ -0,0 +1,98 @@
|
||||
Clear-Host
|
||||
|
||||
$path_scripts = $PSScriptRoot
|
||||
$path_helpers = join-path $path_scripts 'helpers'
|
||||
$path_root = split-path -Parent -Path $path_scripts
|
||||
$path_ue = join-path '../../Surgo' 'UE'
|
||||
$path_project = join-path $path_root 'Project'
|
||||
|
||||
$feditor_log = '-log'
|
||||
|
||||
$fubt_project = '-project'
|
||||
$fubt_projectfiles = '-projectfiles'
|
||||
$fubt_game = '-game'
|
||||
$fubt_engine = '-engine'
|
||||
$fubt_progress = '-progress'
|
||||
|
||||
$ue_editor = join-path $path_ue Engine\Binaries\Win64\UnrealEditor.exe
|
||||
$UAT = join-path $path_ue 'Engine\Build\BatchFiles\RunUAT.bat'
|
||||
$UBT = join-path $path_ue 'Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe'
|
||||
|
||||
$uproject = join-path $path_project 'Gasa.uproject'
|
||||
|
||||
|
||||
$UAT_BuildCookRun = 'BuildCookRun'
|
||||
$UAT_BuildGame = 'BuildGame'
|
||||
$UAT_BuildTarget = 'BuildTarget'
|
||||
|
||||
$fUAT_unattended = '-unattended'
|
||||
$fUAT_configuration = '-configuration'
|
||||
$fUAT_no_tools = '-notools'
|
||||
$fUAT_no_xge = '-NoXGE'
|
||||
$fUAT_disable_unity = '-DisableUnity'
|
||||
$fUAT_for_unity_builds = '-ForceUnity'
|
||||
|
||||
$fUAT_client_config = '-clientconfig'
|
||||
|
||||
$fUAT_target_platform = '-targetplatform'
|
||||
$fUAT_server_target_platform = '-servertargetplatform'
|
||||
|
||||
$fUAT_package_target = '-package'
|
||||
$fUAT_skip_package_target = '-skippackage'
|
||||
$fUAT_never_package_target = '-neverpackage'
|
||||
|
||||
$fUAT_project = '-project'
|
||||
|
||||
$fUAT_clean = '-clean'
|
||||
$fUAT_build = '-build'
|
||||
|
||||
$fUAT_editor = '-editor'
|
||||
|
||||
$fUAT_cook = '-cook'
|
||||
$fUAT_cook_on_the_fly_streaming = '-cookontheflystreaming'
|
||||
|
||||
$fUAT_cook_all = '-CookAll'
|
||||
$fUAT_cook_maps_only = '-CookMapsOnly'
|
||||
|
||||
$fUAT_stage_prequisites = '-prereqs'
|
||||
$fUAT_stage = '-stage'
|
||||
$fUAT_run = '-run'
|
||||
|
||||
$fUAT_rehydrate_assets = '-rehydrateassets' # Downloads assets that are only referenced virtually
|
||||
$fUAT_archive = '-archive'
|
||||
$fUAT_skip_cook = '-skipcook'
|
||||
$fUAT_skip_cook_on_the_fly = '-skipcookonthefly'
|
||||
$fUAT_skip_stage = '-skipstage'
|
||||
$fUAT_generate_pak = '-pak'
|
||||
$fUAT_pak_align_for_memory_mapping = '-PakAlignForMemoryMapping'
|
||||
|
||||
$fUAT_map_to_run = '-map'
|
||||
$fUAT_server_map_additional_params = '-AdditionalServerMapParams'
|
||||
|
||||
$fUAT_distibute = '-distribute'
|
||||
$fUAT_deploy = '-deploy'
|
||||
|
||||
# Build-Cook-Run combo
|
||||
$fUAT_bcr_server_target = '-dedicatedserver'
|
||||
$fUAT_bcr_client_target = '-client'
|
||||
$fUAT_run_just_server = '-noclient'
|
||||
$fUAT_client_open_log = '-logwindow'
|
||||
$fUAT_skip_server = '-skipserver'
|
||||
|
||||
# Push-Location $path_ue
|
||||
Push-Location $path_project
|
||||
|
||||
$UAT_args = @()
|
||||
$UAT_args += $UAT_BuildCookRun
|
||||
$UAT_args += "$fUAT_project=$uproject"
|
||||
$UAT_args += "$fUAT_target_platform=Win64"
|
||||
$UAT_args += "$fUAT_client_config=Development"
|
||||
$UAT_args += $fUAT_editor
|
||||
$UAT_args += $fUAT_build
|
||||
# $UAT_args += $fUAT_cook
|
||||
# $UAT_args += $fUAT_cook_all
|
||||
# $UAT_args += $fUAT_stage
|
||||
|
||||
& $UAT $UAT_args
|
||||
|
||||
Pop-Location
|
Loading…
Reference in New Issue
Block a user