Add Crosshair Expansion when OnFire is called.

This commit is contained in:
Louis Hobbs 2023-08-08 22:02:56 +01:00
parent dc9339ef90
commit 1fb9930791
3 changed files with 12 additions and 2 deletions

BIN
Content/UI/WidgetHUD.uasset (Stored with Git LFS)

Binary file not shown.

View File

@ -17,4 +17,11 @@ void UPlayerHUDWidget::NativeConstruct()
void UPlayerHUDWidget::ExpandCrosshair() void UPlayerHUDWidget::ExpandCrosshair()
{ {
if (CrosshairFired)
{
auto player = Cast<APlayerCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
float playbackSpeed = 1.0 / player->GetCurrentWeapon()->GetWeaponProperties()->WeaponCooldown;
PlayAnimation(CrosshairFired, 0.0f, 1, EUMGSequencePlayMode::Forward, playbackSpeed);
}
} }

View File

@ -46,4 +46,7 @@ public:
UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
UImage* CrosshairImage; UImage* CrosshairImage;
UPROPERTY(Transient, meta = (BindWidgetAnim))
UWidgetAnimation* CrosshairFired;
}; };