diff --git a/EndlessVendetta/Content/BountySystem/Waypoint/WBP_MiniWaypoint.uasset b/EndlessVendetta/Content/BountySystem/Waypoint/WBP_MiniWaypoint.uasset index 4162142b..cd79767a 100644 --- a/EndlessVendetta/Content/BountySystem/Waypoint/WBP_MiniWaypoint.uasset +++ b/EndlessVendetta/Content/BountySystem/Waypoint/WBP_MiniWaypoint.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3d5b6b3ec13c451b42ae7c71efdfc6878d1e4dbdb366e7256834767a8cd6364 -size 42017 +oid sha256:432d04e87414a6a95285b4468bfe64d4631557cef349a37f6e60087e843f85d9 +size 48883 diff --git a/EndlessVendetta/Content/BountySystem/Waypoint/WaypointArrow.png b/EndlessVendetta/Content/BountySystem/Waypoint/WaypointArrow.png new file mode 100644 index 00000000..5909a350 --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/Waypoint/WaypointArrow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9cd8b801f66f1241477554f28ec764079c875e75400bf22dec42494c2807650 +size 44164 diff --git a/EndlessVendetta/Content/BountySystem/Waypoint/WaypointArrow.uasset b/EndlessVendetta/Content/BountySystem/Waypoint/WaypointArrow.uasset new file mode 100644 index 00000000..efc268bd --- /dev/null +++ b/EndlessVendetta/Content/BountySystem/Waypoint/WaypointArrow.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd99b04a977e5fa33f966683ec783006f1289b9ea7cb856f646aafc057293fe6 +size 33619 diff --git a/EndlessVendetta/Content/Levels/TrainingFacility.umap b/EndlessVendetta/Content/Levels/TrainingFacility.umap index 2ebfb2cd..f16e3960 100644 --- a/EndlessVendetta/Content/Levels/TrainingFacility.umap +++ b/EndlessVendetta/Content/Levels/TrainingFacility.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c4ea69a798330d981b7d72fce4e0999e306589ee7e0b3b49ce9a69adf36d6348 +oid sha256:d3943e1a064276d17b897a7a10a3c42a35c75d6c02117bd1ea962544f3576a9b size 654898 diff --git a/EndlessVendetta/Source/EndlessVendetta/UserWidgets/MiniWaypoint.cpp b/EndlessVendetta/Source/EndlessVendetta/UserWidgets/MiniWaypoint.cpp index bb2d4640..03a7b6be 100644 --- a/EndlessVendetta/Source/EndlessVendetta/UserWidgets/MiniWaypoint.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/UserWidgets/MiniWaypoint.cpp @@ -4,7 +4,6 @@ #include "MiniWaypoint.h" - void UMiniWaypoint::NativeTick(const FGeometry& MyGeometry, float InDeltaTime) { Super::NativeTick(MyGeometry, InDeltaTime); @@ -14,13 +13,15 @@ void UMiniWaypoint::NativeTick(const FGeometry& MyGeometry, float InDeltaTime) 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::IsWithin(ScreenLoc.X, -0.01, 0.01) && FMath::IsWithin(ScreenLoc.Y, -0.01, 0.01)) { - float PlayerYaw = PlayerController->GetControlRotation().Yaw; - float TargetYaw = (WorldLoc - PlayerController->GetPawn()->GetActorLocation()).Rotation().Yaw; - if (TargetYaw < 0 ) TargetYaw += 360; - // Check if waypoint is closer to the players right bool TargetOnTheRight; if (PlayerYaw >= TargetYaw) @@ -57,7 +58,8 @@ void UMiniWaypoint::NativeTick(const FGeometry& MyGeometry, float InDeltaTime) IconCanvasPanelSlot->SetPosition(ScreenLoc); } -void UMiniWaypoint::SetIconPanelSlot(UImage* IconImage) +void UMiniWaypoint::SetIconPanelSlot(UCanvasPanel* IconParent, UImage* ArrowImageComp) { - IconCanvasPanelSlot = Cast(IconImage->Slot); + ArrowImage = ArrowImageComp; + IconCanvasPanelSlot = Cast(IconParent->Slot); } diff --git a/EndlessVendetta/Source/EndlessVendetta/UserWidgets/MiniWaypoint.h b/EndlessVendetta/Source/EndlessVendetta/UserWidgets/MiniWaypoint.h index 0089f226..9f810bfd 100644 --- a/EndlessVendetta/Source/EndlessVendetta/UserWidgets/MiniWaypoint.h +++ b/EndlessVendetta/Source/EndlessVendetta/UserWidgets/MiniWaypoint.h @@ -5,6 +5,7 @@ #include "CoreMinimal.h" #include "Blueprint/UserWidget.h" #include "Components/CanvasPanelSlot.h" +#include "Components/CanvasPanel.h" #include "Components/Image.h" #include "MiniWaypoint.generated.h" @@ -19,10 +20,11 @@ class ENDLESSVENDETTA_API UMiniWaypoint : public UUserWidget void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override; UCanvasPanelSlot* IconCanvasPanelSlot; + UImage* ArrowImage; -protected: +protected: UFUNCTION(BlueprintCallable) - void SetIconPanelSlot(UImage* IconImage); + void SetIconPanelSlot(UCanvasPanel* IconParent, UImage* ArrowImageComp); public: FVector WorldLoc = FVector(0, 0, 0);