Merge remote-tracking branch 'origin/CheckpointUI' into Inventory-System

# Conflicts:
#	EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
#	EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
This commit is contained in:
Philip W 2023-11-27 00:45:32 +00:00
commit 7aecf2a69c
52 changed files with 343 additions and 61 deletions

View File

@ -1,7 +1,62 @@
[/Script/Engine.CollisionProfile] [/Script/Engine.CollisionProfile]
+Profiles=(Name="Projectile",CollisionEnabled=QueryOnly,ObjectTypeName="Projectile",CustomResponses=,HelpMessage="Preset for projectiles",bCanModify=True) -Profiles=(Name="NoCollision",CollisionEnabled=NoCollision,ObjectTypeName="WorldStatic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore)),HelpMessage="No collision",bCanModify=False)
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,Name="Projectile",DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False) -Profiles=(Name="BlockAll",CollisionEnabled=QueryAndPhysics,ObjectTypeName="WorldStatic",CustomResponses=,HelpMessage="WorldStatic object that blocks all actors by default. All new custom channels will use its own default response. ",bCanModify=False)
+EditProfiles=(Name="Trigger",CustomResponses=((Channel=Projectile, Response=ECR_Ignore))) -Profiles=(Name="OverlapAll",CollisionEnabled=QueryOnly,ObjectTypeName="WorldStatic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility",Response=ECR_Overlap),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ",bCanModify=False)
-Profiles=(Name="BlockAllDynamic",CollisionEnabled=QueryAndPhysics,ObjectTypeName="WorldDynamic",CustomResponses=,HelpMessage="WorldDynamic object that blocks all actors by default. All new custom channels will use its own default response. ",bCanModify=False)
-Profiles=(Name="OverlapAllDynamic",CollisionEnabled=QueryOnly,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility",Response=ECR_Overlap),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldDynamic object that overlaps all actors by default. All new custom channels will use its own default response. ",bCanModify=False)
-Profiles=(Name="IgnoreOnlyPawn",CollisionEnabled=QueryOnly,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore)),HelpMessage="WorldDynamic object that ignores Pawn and Vehicle. All other channels will be set to default.",bCanModify=False)
-Profiles=(Name="OverlapOnlyPawn",CollisionEnabled=QueryOnly,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="Pawn",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Ignore)),HelpMessage="WorldDynamic object that overlaps Pawn, Camera, and Vehicle. All other channels will be set to default. ",bCanModify=False)
-Profiles=(Name="Pawn",CollisionEnabled=QueryAndPhysics,ObjectTypeName="Pawn",CustomResponses=((Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Pawn object. Can be used for capsule of any playerable character or AI. ",bCanModify=False)
-Profiles=(Name="Spectator",CollisionEnabled=QueryOnly,ObjectTypeName="Pawn",CustomResponses=((Channel="WorldStatic",Response=ECR_Block),(Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore)),HelpMessage="Pawn object that ignores all other actors except WorldStatic.",bCanModify=False)
-Profiles=(Name="CharacterMesh",CollisionEnabled=QueryOnly,ObjectTypeName="Pawn",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Pawn object that is used for Character Mesh. All other channels will be set to default.",bCanModify=False)
-Profiles=(Name="PhysicsActor",CollisionEnabled=QueryAndPhysics,ObjectTypeName="PhysicsBody",CustomResponses=,HelpMessage="Simulating actors",bCanModify=False)
-Profiles=(Name="Destructible",CollisionEnabled=QueryAndPhysics,ObjectTypeName="Destructible",CustomResponses=,HelpMessage="Destructible actors",bCanModify=False)
-Profiles=(Name="InvisibleWall",CollisionEnabled=QueryAndPhysics,ObjectTypeName="WorldStatic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore)),HelpMessage="WorldStatic object that is invisible.",bCanModify=False)
-Profiles=(Name="InvisibleWallDynamic",CollisionEnabled=QueryAndPhysics,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore)),HelpMessage="WorldDynamic object that is invisible.",bCanModify=False)
-Profiles=(Name="Trigger",CollisionEnabled=QueryOnly,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldDynamic object that is used for trigger. All other channels will be set to default.",bCanModify=False)
-Profiles=(Name="Ragdoll",CollisionEnabled=QueryAndPhysics,ObjectTypeName="PhysicsBody",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Simulating Skeletal Mesh Component. All other channels will be set to default.",bCanModify=False)
-Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.",bCanModify=False)
-Profiles=(Name="UI",CollisionEnabled=QueryOnly,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility",Response=ECR_Block),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ",bCanModify=False)
+Profiles=(Name="NoCollision",CollisionEnabled=NoCollision,bCanModify=False,ObjectTypeName="WorldStatic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore)),HelpMessage="No collision")
+Profiles=(Name="BlockAll",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="WorldStatic",CustomResponses=,HelpMessage="WorldStatic object that blocks all actors by default. All new custom channels will use its own default response. ")
+Profiles=(Name="OverlapAll",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldStatic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility",Response=ECR_Overlap),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
+Profiles=(Name="BlockAllDynamic",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=,HelpMessage="WorldDynamic object that blocks all actors by default. All new custom channels will use its own default response. ")
+Profiles=(Name="OverlapAllDynamic",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility",Response=ECR_Overlap),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldDynamic object that overlaps all actors by default. All new custom channels will use its own default response. ")
+Profiles=(Name="IgnoreOnlyPawn",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore)),HelpMessage="WorldDynamic object that ignores Pawn and Vehicle. All other channels will be set to default.")
+Profiles=(Name="OverlapOnlyPawn",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="Pawn",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Ignore)),HelpMessage="WorldDynamic object that overlaps Pawn, Camera, and Vehicle. All other channels will be set to default. ")
+Profiles=(Name="Pawn",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Pawn",CustomResponses=((Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Pawn object. Can be used for capsule of any playerable character or AI. ")
+Profiles=(Name="Spectator",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="Pawn",CustomResponses=((Channel="WorldStatic"),(Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore)),HelpMessage="Pawn object that ignores all other actors except WorldStatic.")
+Profiles=(Name="CharacterMesh",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="Pawn",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Pawn object that is used for Character Mesh. All other channels will be set to default.")
+Profiles=(Name="PhysicsActor",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="PhysicsBody",CustomResponses=,HelpMessage="Simulating actors")
+Profiles=(Name="Destructible",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Destructible",CustomResponses=,HelpMessage="Destructible actors")
+Profiles=(Name="InvisibleWall",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="WorldStatic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore)),HelpMessage="WorldStatic object that is invisible.")
+Profiles=(Name="InvisibleWallDynamic",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="Visibility",Response=ECR_Ignore)),HelpMessage="WorldDynamic object that is invisible.")
+Profiles=(Name="Trigger",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility",Response=ECR_Ignore),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldDynamic object that is used for trigger. All other channels will be set to default.")
+Profiles=(Name="Ragdoll",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="PhysicsBody",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Simulating Skeletal Mesh Component. All other channels will be set to default.")
+Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.")
+Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility"),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
+Profiles=(Name="Projectile",CollisionEnabled=QueryOnly,bCanModify=True,ObjectTypeName="Projectile",CustomResponses=,HelpMessage="Preset for projectiles")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Projectile")
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Waypoint")
+EditProfiles=(Name="Trigger",CustomResponses=((Channel="Projectile",Response=ECR_Ignore)))
-ProfileRedirects=(OldName="BlockingVolume",NewName="InvisibleWall")
-ProfileRedirects=(OldName="InterpActor",NewName="IgnoreOnlyPawn")
-ProfileRedirects=(OldName="StaticMeshComponent",NewName="BlockAllDynamic")
-ProfileRedirects=(OldName="SkeletalMeshActor",NewName="PhysicsActor")
-ProfileRedirects=(OldName="InvisibleActor",NewName="InvisibleWallDynamic")
+ProfileRedirects=(OldName="BlockingVolume",NewName="InvisibleWall")
+ProfileRedirects=(OldName="InterpActor",NewName="IgnoreOnlyPawn")
+ProfileRedirects=(OldName="StaticMeshComponent",NewName="BlockAllDynamic")
+ProfileRedirects=(OldName="SkeletalMeshActor",NewName="PhysicsActor")
+ProfileRedirects=(OldName="InvisibleActor",NewName="InvisibleWallDynamic")
-CollisionChannelRedirects=(OldName="Static",NewName="WorldStatic")
-CollisionChannelRedirects=(OldName="Dynamic",NewName="WorldDynamic")
-CollisionChannelRedirects=(OldName="VehicleMovement",NewName="Vehicle")
-CollisionChannelRedirects=(OldName="PawnMovement",NewName="Pawn")
+CollisionChannelRedirects=(OldName="Static",NewName="WorldStatic")
+CollisionChannelRedirects=(OldName="Dynamic",NewName="WorldDynamic")
+CollisionChannelRedirects=(OldName="VehicleMovement",NewName="Vehicle")
+CollisionChannelRedirects=(OldName="PawnMovement",NewName="Pawn")
[/Script/EngineSettings.GameMapsSettings] [/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Levels/TrainingFacility.TrainingFacility EditorStartupMap=/Game/Levels/TrainingFacility.TrainingFacility

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 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.

View File

@ -70,6 +70,7 @@ void ABountyClass::IncrementBountyCheckpoint()
BountyCheckpoints[0]->Destroy(); BountyCheckpoints[0]->Destroy();
BountyCheckpoints.RemoveAt(0); BountyCheckpoints.RemoveAt(0);
UE_LOG(LogTemp, Warning, TEXT(" You've Completed the Bounty!! Well done")); UE_LOG(LogTemp, Warning, TEXT(" You've Completed the Bounty!! Well done"));
Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->CheckpointCompletedUI(FString(""));
return; return;
} }
@ -90,6 +91,8 @@ void ABountyClass::IncrementBountyCheckpoint()
BountyCheckpoints[0]->CheckpointActivated(); BountyCheckpoints[0]->CheckpointActivated();
BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint); BountyCheckpoints[0]->CompletedCheckpoint.AddDynamic(this, &ABountyClass::IncrementBountyCheckpoint);
Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->CheckpointCompletedUI(BountyCheckpoints[0]->GetCheckpointTip());
} }
void ABountyClass::CollectRewards_Implementation() void ABountyClass::CollectRewards_Implementation()

View File

@ -46,6 +46,7 @@ void ACheckpointClass::Tick(float DeltaTime)
void ACheckpointClass::Destroyed() void ACheckpointClass::Destroyed()
{ {
if (WaypointActor) WaypointActor->Destroy(); if (WaypointActor) WaypointActor->Destroy();
Super::Destroyed();
} }

View File

@ -19,6 +19,8 @@ class ENDLESSVENDETTA_API ACheckpointClass : public AActor
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint") UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
FString CheckpointDescription; FString CheckpointDescription;
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint") UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
FString CheckpointTip;
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
FVector WaypointLoc; FVector WaypointLoc;
UPROPERTY(EditDefaultsOnly, Category = "Checkpoint") UPROPERTY(EditDefaultsOnly, Category = "Checkpoint")
UTexture2D* WaypointIcon; UTexture2D* WaypointIcon;
@ -34,7 +36,6 @@ protected:
UFUNCTION(BlueprintCallable, Category = "Checkpoint") UFUNCTION(BlueprintCallable, Category = "Checkpoint")
void BroadcastCompletion() void BroadcastCompletion()
{ {
Cast<AEndlessVendettaCharacter>(GetWorld()->GetFirstPlayerController()->GetPawn())->CheckpointCompletedUI();
CompletedCheckpoint.Broadcast(); CompletedCheckpoint.Broadcast();
} }
@ -61,6 +62,10 @@ public:
{ {
return CheckpointDescription; return CheckpointDescription;
} }
FString GetCheckpointTip()
{
return CheckpointTip;
}
FVector GetWaypointLoc() FVector GetWaypointLoc()
{ {
return WaypointLoc; return WaypointLoc;

View File

@ -3,6 +3,7 @@
#include "WaypointActor.h" #include "WaypointActor.h"
#include "Engine/EngineTypes.h"
#include "EndlessVendetta/EndlessVendettaCharacter.h" #include "EndlessVendetta/EndlessVendettaCharacter.h"
// Sets default values // Sets default values
@ -12,18 +13,19 @@ AWaypointActor::AWaypointActor()
PrimaryActorTick.bCanEverTick = true; PrimaryActorTick.bCanEverTick = true;
} }
// Called when the game starts or when spawned void AWaypointActor::SetupWaypoint_Implementation(UTexture2D* Icon, const FString& Desc)
void AWaypointActor::BeginPlay()
{ {
SetActorTickEnabled(false);
Super::BeginPlay();
SetActorTickInterval(0.05); SetActorTickInterval(0.05);
AActor* PlayerActor = Cast<AActor>(GetWorld()->GetFirstPlayerController()->GetPawn()); AActor* PlayerActor = Cast<AActor>(GetWorld()->GetFirstPlayerController()->GetPawn());
PlayersCam = Cast<UCameraComponent>(PlayerActor->GetComponentByClass(UCameraComponent::StaticClass())); PlayersCam = Cast<UCameraComponent>(PlayerActor->GetComponentByClass(UCameraComponent::StaticClass()));
ScalingMagnitude = (ScaleAtMaxDist - ScaleAtMinDist) / (MaxDist - MinDist); ScalingMagnitude = (ScaleAtMaxDist - ScaleAtMinDist) / (MaxDist - MinDist);
ScalingY_Intercept = ScaleAtMaxDist - (MaxDist * ScalingMagnitude); ScalingY_Intercept = ScaleAtMaxDist - (MaxDist * ScalingMagnitude);
if (PlayersCam) SetActorTickEnabled(true);
MiniWaypoint = CreateWidget<UMiniWaypoint>(GetWorld(), MiniWaypointClass);
MiniWaypoint->AddToViewport(0);
MiniWaypoint->WorldLoc = this->GetActorLocation();
MiniWaypoint->PlayerController = GetWorld()->GetFirstPlayerController();
MiniWaypoint->SetIcon(Icon);
} }
// Called every frame // Called every frame
@ -31,7 +33,31 @@ void AWaypointActor::Tick(float DeltaTime)
{ {
Super::Tick(DeltaTime); Super::Tick(DeltaTime);
if (!PlayersCam) SetActorTickEnabled(false); UpdateScaleAndRotation();
if (SightCheck())
{
UpdateVisibility(true);
MiniWaypoint->UpdateVisibility(false);
return;
}
UpdateVisibility(false);
MiniWaypoint->UpdateVisibility(true);
}
bool AWaypointActor::SightCheck()
{
FHitResult OutHit;
FCollisionObjectQueryParams ObjectQueryParams;
ObjectQueryParams.AddObjectTypesToQuery(ECollisionChannel::ECC_GameTraceChannel2);
FVector LT_Start = PlayersCam->GetComponentLocation();
FVector LT_End = LT_Start + (PlayersCam->GetForwardVector() * WaypointFocusDistance);
if (GetWorld()->LineTraceSingleByObjectType(OutHit, LT_Start, LT_End, ObjectQueryParams) && OutHit.GetActor()->GetUniqueID() == this->GetUniqueID()) return true;
return false;
}
void AWaypointActor::UpdateScaleAndRotation()
{
if (!PlayersCam) return;
FVector WaypointLoc = GetActorLocation(); FVector WaypointLoc = GetActorLocation();
FVector PlayerCamLoc = PlayersCam->GetComponentLocation(); FVector PlayerCamLoc = PlayersCam->GetComponentLocation();
@ -46,3 +72,10 @@ void AWaypointActor::Tick(float DeltaTime)
SetActorScale3D(FVector(1.f, S, S)); SetActorScale3D(FVector(1.f, S, S));
} }
void AWaypointActor::Destroyed()
{
if (IsValid(MiniWaypoint)) MiniWaypoint->RemoveFromParent();
Super::Destroyed();
}

View File

@ -4,6 +4,7 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Camera/CameraComponent.h" #include "Camera/CameraComponent.h"
#include "EndlessVendetta/UserWidgets/MiniWaypoint.h"
#include "GameFramework/Actor.h" #include "GameFramework/Actor.h"
#include "WaypointActor.generated.h" #include "WaypointActor.generated.h"
@ -18,6 +19,14 @@ class ENDLESSVENDETTA_API AWaypointActor : public AActor
float ScalingY_Intercept; float ScalingY_Intercept;
UPROPERTY(EditDefaultsOnly, Category = "Waypoint")
float WaypointFocusDistance = 3000;
UPROPERTY(EditDefaultsOnly, Category = "Waypoint")
TSubclassOf<UMiniWaypoint> MiniWaypointClass;
UMiniWaypoint* MiniWaypoint;
UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling") UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling")
float MaxDist = 16000.f; float MaxDist = 16000.f;
@ -30,9 +39,15 @@ class ENDLESSVENDETTA_API AWaypointActor : public AActor
UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling") UPROPERTY(EditDefaultsOnly, Category = "Waypoint Scaling")
float ScaleAtMinDist = 0.15; float ScaleAtMinDist = 0.15;
void UpdateScaleAndRotation();
bool SightCheck();
protected: protected:
// Called when the game starts or when spawned UFUNCTION(BlueprintImplementableEvent)
virtual void BeginPlay() override; void UpdateVisibility(bool IsVisible);
void Destroyed() override;
public: public:
// Sets default values for this actor's properties // Sets default values for this actor's properties
@ -41,7 +56,7 @@ public:
// Called every frame // Called every frame
virtual void Tick(float DeltaTime) override; virtual void Tick(float DeltaTime) override;
UFUNCTION(BlueprintImplementableEvent) UFUNCTION(BlueprintNativeEvent)
void SetupWaypoint(UTexture2D* Icon, const FString& Desc); void SetupWaypoint(UTexture2D* Icon, const FString& Desc);
}; };

View File

@ -198,7 +198,7 @@ public:
void WeaponSwitcher(AActor* Outhit); void WeaponSwitcher(AActor* Outhit);
UFUNCTION(BlueprintImplementableEvent) UFUNCTION(BlueprintImplementableEvent)
void CheckpointCompletedUI(); void CheckpointCompletedUI(const FString& CheckpointDesc);
// Returns true if successfully changed to a new gadget, can fail if the target gadget to replace is being used // Returns true if successfully changed to a new gadget, can fail if the target gadget to replace is being used
bool UpdateGadgetType(TSubclassOf<AGadgetBase> NewGadgetClass); bool UpdateGadgetType(TSubclassOf<AGadgetBase> NewGadgetClass);

View File

@ -0,0 +1,65 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "MiniWaypoint.h"
void UMiniWaypoint::NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
{
Super::NativeTick(MyGeometry, InDeltaTime);
if (!IsValid(IconCanvasPanelSlot) || !IsValid(PlayerController)) return;
FVector2D ScreenLoc;
PlayerController->ProjectWorldLocationToScreen(WorldLoc, ScreenLoc);
float TargetYaw = (WorldLoc - PlayerController->GetPawn()->GetActorLocation()).Rotation().Yaw;
float PlayerYaw = PlayerController->GetControlRotation().Yaw;
if (TargetYaw < 0 ) TargetYaw += 360;
ArrowImage->SetRenderTransformAngle(TargetYaw - PlayerYaw);
// Check if waypoint is outside of players vision frustum
if (FMath::IsNearlyZero(ScreenLoc.X) && FMath::IsNearlyZero(ScreenLoc.Y) && !FMath::IsNearlyZero(IconCanvasPanelSlot->GetPosition().X))//(FMath::IsWithin(ScreenLoc.X, -0.01, 0.01) && FMath::IsWithin(ScreenLoc.Y, -0.01, 0.01))
{
// Check if waypoint is closer to the players right
bool TargetOnTheRight;
if (PlayerYaw >= TargetYaw)
{
TargetOnTheRight = FMath::Abs(TargetYaw - PlayerYaw) >= 180;
}
else
{
TargetOnTheRight = TargetYaw - PlayerYaw <= 180;
}
FVector2D NewPos = IconCanvasPanelSlot->GetPosition();
if ((TargetOnTheRight && NewPos.X < 0) || (!TargetOnTheRight && NewPos.X > 0)) NewPos.X *= -1;
IconCanvasPanelSlot->SetPosition(NewPos);
return;
}
FVector2d ViewPortSize;
GEngine->GameViewport->GetViewportSize(ViewPortSize);
float ViewportHalfX = ViewPortSize.X / 2.f;
float ViewportHalfY = ViewPortSize.Y / 2.f;
// Centers the icon
ScreenLoc.X -= ViewportHalfX;
ScreenLoc.Y -= ViewportHalfY;
float ViewportMarginX = ViewportHalfX * 0.8f;
float ViewportMarginY = ViewportHalfY * 0.6f;
ScreenLoc.X = FMath::Clamp(ScreenLoc.X, ViewportMarginX * -1.f, ViewportMarginX);
ScreenLoc.Y = FMath::Clamp(ScreenLoc.Y, ViewportMarginY * -1.f, ViewportMarginY);
IconCanvasPanelSlot->SetPosition(ScreenLoc);
}
void UMiniWaypoint::SetIconPanelSlot(UCanvasPanel* IconParent, UImage* ArrowImageComp)
{
ArrowImage = ArrowImageComp;
IconCanvasPanelSlot = Cast<UCanvasPanelSlot>(IconParent->Slot);
}

View File

@ -0,0 +1,39 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "Components/CanvasPanelSlot.h"
#include "Components/CanvasPanel.h"
#include "Components/Image.h"
#include "MiniWaypoint.generated.h"
/**
*
*/
UCLASS()
class ENDLESSVENDETTA_API UMiniWaypoint : public UUserWidget
{
GENERATED_BODY()
void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;
UCanvasPanelSlot* IconCanvasPanelSlot;
UImage* ArrowImage;
protected:
UFUNCTION(BlueprintCallable)
void SetIconPanelSlot(UCanvasPanel* IconParent, UImage* ArrowImageComp);
public:
FVector WorldLoc = FVector(0, 0, 0);
APlayerController* PlayerController;
UFUNCTION(BlueprintImplementableEvent)
void UpdateVisibility(bool IsVisible);
UFUNCTION(BlueprintImplementableEvent)
void SetIcon(UTexture2D* Icon);
};