Move `SetInventoryToDefault` call to base character `BeginPlay`

This commit is contained in:
Louis Hobbs 2023-02-09 22:11:25 +00:00
parent d56e25ad62
commit 4582493b8e
2 changed files with 1 additions and 5 deletions

View File

@ -17,6 +17,7 @@ void ANakatomiCharacter::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
SetInventoryToDefault();
} }
// Called every frame // Called every frame

View File

@ -55,7 +55,6 @@ void APlayerCharacter::BeginPlay()
Super::BeginPlay(); Super::BeginPlay();
DefaultMovementSpeed = GetCharacterMovement()->MaxWalkSpeed; DefaultMovementSpeed = GetCharacterMovement()->MaxWalkSpeed;
SetInventoryToDefault();
if (!this->ActorHasTag(FName("Player"))) if (!this->ActorHasTag(FName("Player")))
{ {
@ -237,7 +236,6 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits)
FCollisionQueryParams TraceParams(SCENE_QUERY_STAT(WeaponTrace), true, GetInstigator()); FCollisionQueryParams TraceParams(SCENE_QUERY_STAT(WeaponTrace), true, GetInstigator());
TraceParams.bReturnPhysicalMaterial = true; TraceParams.bReturnPhysicalMaterial = true;
for (size_t i = 0; i < CurrentWeapon->GetWeaponProperties()->ProjectilesPerShot; i++) for (size_t i = 0; i < CurrentWeapon->GetWeaponProperties()->ProjectilesPerShot; i++)
{ {
// Calculate the maximum distance the weapon can fire // Calculate the maximum distance the weapon can fire
@ -259,7 +257,6 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits)
FTransform transform; FTransform transform;
transform.SetLocation(Result.ImpactPoint); transform.SetLocation(Result.ImpactPoint);
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters); auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
fields.Add(field);
if (Result.GetActor()) if (Result.GetActor())
{ {
@ -272,8 +269,6 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* hits)
} }
} }
} }
void APlayerCharacter::SetInventoryToDefault()
} }
void APlayerCharacter::WeaponSwitchingCallback(const FInputActionInstance& Instance) void APlayerCharacter::WeaponSwitchingCallback(const FInputActionInstance& Instance)