Merge branch 'Animation' into Polishing-Checkpoints

This commit is contained in:
Rafal Swierczek 2024-05-11 11:45:03 +01:00
commit 0fedf8af84
9 changed files with 29 additions and 23 deletions

Binary file not shown.

View File

@ -483,10 +483,10 @@ void AEndlessVendettaCharacter::EquipPrimary()
if (bIsReloading) return; if (bIsReloading) return;
if (IsValid(PrimaryWeapon)) if (IsValid(PrimaryWeapon))
{ {
TempUnequippedPrimary(); //TempUnequippedPrimary();
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("IsPrimaryWeapon valid check running")); GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("IsPrimaryWeapon valid check running"));
PrimaryWeapon->DetachFromActor(DetatchRules); //PrimaryWeapon->DetachFromActor(DetatchRules);
PrimaryWeapon->AttachToComponent(FirstPersonArms, AttachmentRules, FName("UnEquipGunSocket")); //PrimaryWeapon->AttachToComponent(FirstPersonArms, AttachmentRules, FName("UnEquipGunSocket"));
PrimaryWeapon->SetActorHiddenInGame(true); PrimaryWeapon->SetActorHiddenInGame(true);
PrimaryWeapon->SetActorEnableCollision(false); PrimaryWeapon->SetActorEnableCollision(false);
this->GetFirstPersonCameraComponent()->SetFieldOfView(90); this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
@ -516,9 +516,11 @@ void AEndlessVendettaCharacter::EquipPrimary()
if (!bIsPrimaryWeaponCreated) if (!bIsPrimaryWeaponCreated)
{ {
PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams); //PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
HeldWeapon->SetChildActorClass(PrimaryWeaponClass);
PrimaryWeaponActor = HeldWeapon->GetChildActor();
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("Spawning weapon")); GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("Spawning weapon"));
PrimaryWeaponActor->AttachToComponent(FirstPersonArms, AttachmentRules, FName("GripPoint")); //PrimaryWeaponActor->AttachToComponent(FirstPersonArms, AttachmentRules, FName("GripPoint"));
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor); PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
PrimaryWeapon->SetActorHiddenInGame(false); PrimaryWeapon->SetActorHiddenInGame(false);
PrimaryWeapon->SetActorEnableCollision(false); PrimaryWeapon->SetActorEnableCollision(false);
@ -531,15 +533,17 @@ void AEndlessVendettaCharacter::EquipPrimary()
if (PrimaryWeaponClass != nullptr) if (PrimaryWeaponClass != nullptr)
{ {
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running")); GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running"));
PrimaryWeaponActor->AttachToComponent(FirstPersonArms, AttachmentRules, FName("GripPoint")); //PrimaryWeaponActor->AttachToComponent(FirstPersonArms, AttachmentRules, FName("GripPoint"));
HeldWeapon->SetChildActorClass(PrimaryWeaponClass);
PrimaryWeaponActor = HeldWeapon->GetChildActor();
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor); PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
PrimaryWeapon->SetActorHiddenInGame(false); PrimaryWeapon->SetActorHiddenInGame(false);
PrimaryWeapon->SetActorEnableCollision(false); PrimaryWeapon->SetActorEnableCollision(false);
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle); //GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
bIsCurrentlyHoldingWeapon = true; bIsCurrentlyHoldingWeapon = true;
bHasRifle = true; bHasRifle = true;
SetOverlayState(EOverlayState::AssaultRifle); SetOverlayState(EOverlayState::AssaultRifle);
TempEquippedPrimary(); //TempEquippedPrimary();
EquippedWeapon.Broadcast(); EquippedWeapon.Broadcast();
} }
} }
@ -594,6 +598,8 @@ void AEndlessVendettaCharacter::EquipSecondary()
} }
if (SecondaryWeaponClass != nullptr) if (SecondaryWeaponClass != nullptr)
{ {
HeldWeapon->SetChildActorClass(SecondaryWeaponClass);
SecondaryWeaponActor = HeldWeapon->GetChildActor();
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor); SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
SecondaryWeapon->SetActorHiddenInGame(false); SecondaryWeapon->SetActorHiddenInGame(false);
bIsCurrentlyHoldingWeapon = true; bIsCurrentlyHoldingWeapon = true;