Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Rafal Swierczek 2023-10-23 11:49:16 +01:00
commit 14fa4621e3
2 changed files with 5 additions and 1 deletions

View File

@ -223,6 +223,7 @@ void AEndlessVendettaCharacter::ToggleCombat()
//When 1 is pressed it calls EquipPrimary //When 1 is pressed it calls EquipPrimary
void AEndlessVendettaCharacter::EquipPrimary() void AEndlessVendettaCharacter::EquipPrimary()
{ {
if (bIsReloading) return;
if (IsValid(PrimaryWeapon)) if (IsValid(PrimaryWeapon))
{ {
PrimaryWeapon->Destroy(); PrimaryWeapon->Destroy();
@ -249,11 +250,12 @@ void AEndlessVendettaCharacter::EquipPrimary()
//Changing PrimaryWeaponActor to ABaseWeaponClass type instead of actor and storing it into PrimaryWeapon which is a ABaseClass Object //Changing PrimaryWeaponActor to ABaseWeaponClass type instead of actor and storing it into PrimaryWeapon which is a ABaseClass Object
//We do this because we need to check if PrimaryWeapon is equipped and we want primaryweapon to be ABaseWeapon type and not a generic AActor //We do this because we need to check if PrimaryWeapon is equipped and we want primaryweapon to be ABaseWeapon type and not a generic AActor
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor); PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
} }
void AEndlessVendettaCharacter::EquipSecondary() void AEndlessVendettaCharacter::EquipSecondary()
{ {
if (bIsReloading) return;
if (IsValid(SecondaryWeapon)) if (IsValid(SecondaryWeapon))
{ {
SecondaryWeapon->Destroy(); SecondaryWeapon->Destroy();
@ -277,6 +279,7 @@ void AEndlessVendettaCharacter::EquipSecondary()
AActor* SecondaryWeaponActor = GetWorld()->SpawnActor<AActor>(SecondaryWeaponClass, spawnParams); AActor* SecondaryWeaponActor = GetWorld()->SpawnActor<AActor>(SecondaryWeaponClass, spawnParams);
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor); SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
GetWorldTimerManager().ClearTimer(SecondaryWeapon->reloadTimerHandle);
} }
void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit) void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)

View File

@ -55,6 +55,7 @@ public:
virtual void Tick(float DeltaTime) override; virtual void Tick(float DeltaTime) override;
void ReloadTimer(); void ReloadTimer();
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
FString WeaponName; FString WeaponName;