Update Character to Trigger Pistol Reload Animation

This commit is contained in:
Philip W 2024-03-14 17:33:41 +00:00
parent eab0b2b18b
commit 5ac9e3fda5
5 changed files with 24 additions and 9 deletions

View File

@ -54,7 +54,15 @@ void AEndlessVendettaCharacter::DecrementRestrictedBoundsCount()
void AEndlessVendettaCharacter::ReloadAnimationComplete()
{
bIsReloading = false;
if (IsValid(PrimaryWeapon))
{
PrimaryWeapon->WeaponReload();
}
if (IsValid(SecondaryWeapon))
{
if (!bIsReloading) return;
SecondaryWeapon->WeaponReload();
}
}
void AEndlessVendettaCharacter::SetOverlayState(const EOverlayState OverlayState) const
@ -639,12 +647,15 @@ void AEndlessVendettaCharacter::GunReload()
if (InPauseMenu) return;
if (IsValid(PrimaryWeapon))
{
if (PrimaryWeapon->currentAmmoCount == PrimaryWeapon->MagazineSize) return;
PrimaryWeapon->ReloadTimer();
bIsReloading = true;
}
if (IsValid(SecondaryWeapon))
else if (IsValid(SecondaryWeapon))
{
SecondaryWeapon->ReloadTimer();
if (SecondaryWeapon->currentAmmoCount == SecondaryWeapon->MagazineSize) return;
StartReload.Broadcast();
SecondaryWeapon->ShowReloadingWidget();
bIsReloading = true;
}
}

View File

@ -150,7 +150,10 @@ public:
void IncrementRestrictedBoundsCount();
UFUNCTION(BlueprintCallable)
void DecrementRestrictedBoundsCount();
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FReloadAnimationComplete);
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FStartReload);
UPROPERTY(BlueprintAssignable, Category = "Weapon")
FStartReload StartReload;
UFUNCTION(BlueprintCallable, Category = "Weapon")
void ReloadAnimationComplete();

View File

@ -43,8 +43,6 @@ protected:
float recoilResultPitch = 0;
float recoilResultYaw = 0;
UFUNCTION(BlueprintImplementableEvent)
void ShowReloadingWidget();
UFUNCTION(BlueprintImplementableEvent)
void HideReloadingWidget();
@ -177,6 +175,9 @@ public:
UFUNCTION(BlueprintCallable)
void SetupSilencerAttachment(UStaticMesh* SilencerMesh);
UFUNCTION(BlueprintImplementableEvent)
void ShowReloadingWidget();
UFUNCTION(BlueprintImplementableEvent)
void ShowNeedReloadUI();