From 4582493b8ef9765f110efd3f30faafb686cc0abb Mon Sep 17 00:00:00 2001 From: Louis Hobbs Date: Thu, 9 Feb 2023 22:11:25 +0000 Subject: [PATCH] Move `SetInventoryToDefault` call to base character `BeginPlay` --- Source/Nakatomi/NakatomiCharacter.cpp | 1 + Source/Nakatomi/PlayerCharacter.cpp | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Source/Nakatomi/NakatomiCharacter.cpp b/Source/Nakatomi/NakatomiCharacter.cpp index 9e4c540..beb01fa 100644 --- a/Source/Nakatomi/NakatomiCharacter.cpp +++ b/Source/Nakatomi/NakatomiCharacter.cpp @@ -17,6 +17,7 @@ void ANakatomiCharacter::BeginPlay() { Super::BeginPlay(); + SetInventoryToDefault(); } // Called every frame diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index 7905a85..e2a2fe0 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -55,7 +55,6 @@ void APlayerCharacter::BeginPlay() Super::BeginPlay(); DefaultMovementSpeed = GetCharacterMovement()->MaxWalkSpeed; - SetInventoryToDefault(); if (!this->ActorHasTag(FName("Player"))) { @@ -237,7 +236,6 @@ void APlayerCharacter::CalculateHits(TArray* hits) FCollisionQueryParams TraceParams(SCENE_QUERY_STAT(WeaponTrace), true, GetInstigator()); TraceParams.bReturnPhysicalMaterial = true; - for (size_t i = 0; i < CurrentWeapon->GetWeaponProperties()->ProjectilesPerShot; i++) { // Calculate the maximum distance the weapon can fire @@ -259,7 +257,6 @@ void APlayerCharacter::CalculateHits(TArray* hits) FTransform transform; transform.SetLocation(Result.ImpactPoint); auto field = GetWorld()->SpawnActor(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters); - fields.Add(field); if (Result.GetActor()) { @@ -272,8 +269,6 @@ void APlayerCharacter::CalculateHits(TArray* hits) } } } - -void APlayerCharacter::SetInventoryToDefault() } void APlayerCharacter::WeaponSwitchingCallback(const FInputActionInstance& Instance)