From 1fb9930791e30de8e888766da6536b2480c0f952 Mon Sep 17 00:00:00 2001 From: Louis Hobbs Date: Tue, 8 Aug 2023 22:02:56 +0100 Subject: [PATCH] Add Crosshair Expansion when OnFire is called. --- Content/UI/WidgetHUD.uasset | 4 ++-- Source/Nakatomi/PlayerHUDWidget.cpp | 7 +++++++ Source/Nakatomi/PlayerHUDWidget.h | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Content/UI/WidgetHUD.uasset b/Content/UI/WidgetHUD.uasset index 4cc1ad3..14ae101 100644 --- a/Content/UI/WidgetHUD.uasset +++ b/Content/UI/WidgetHUD.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b5ca37fc88274daecf4f8fbb27ad550719a79a1b315bf8b77fbeeb2bb2d5f546 -size 140409 +oid sha256:3328013e820944df8a863932da622b33025137290968e81f8cea55385e3f7e98 +size 152326 diff --git a/Source/Nakatomi/PlayerHUDWidget.cpp b/Source/Nakatomi/PlayerHUDWidget.cpp index fd74640..98633af 100644 --- a/Source/Nakatomi/PlayerHUDWidget.cpp +++ b/Source/Nakatomi/PlayerHUDWidget.cpp @@ -17,4 +17,11 @@ void UPlayerHUDWidget::NativeConstruct() void UPlayerHUDWidget::ExpandCrosshair() { + if (CrosshairFired) + { + auto player = Cast(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0)); + float playbackSpeed = 1.0 / player->GetCurrentWeapon()->GetWeaponProperties()->WeaponCooldown; + + PlayAnimation(CrosshairFired, 0.0f, 1, EUMGSequencePlayMode::Forward, playbackSpeed); + } } diff --git a/Source/Nakatomi/PlayerHUDWidget.h b/Source/Nakatomi/PlayerHUDWidget.h index 07ac7b9..dc1deb2 100644 --- a/Source/Nakatomi/PlayerHUDWidget.h +++ b/Source/Nakatomi/PlayerHUDWidget.h @@ -46,4 +46,7 @@ public: UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UImage* CrosshairImage; + + UPROPERTY(Transient, meta = (BindWidgetAnim)) + UWidgetAnimation* CrosshairFired; };