// Fill out your copyright notice in the Description page of Project Settings. #include "HealthPickup.h" #include "NiagaraComponent.h" #include "NiagaraFunctionLibrary.h" #include "Blaster/Character/BlasterCharacter.h" AHealthPickup::AHealthPickup() { bReplicates = true; PickupEffectComponent = CreateDefaultSubobject(TEXT("PickupEffectComponent")); PickupEffectComponent->SetupAttachment(RootComponent); } void AHealthPickup::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) { Super::OnSphereOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult); ABlasterCharacter* BlasterCharacter = Cast(OtherActor); if (BlasterCharacter) { } Destroy(); } void AHealthPickup::Destroyed() { if (PickupEffect) { UNiagaraFunctionLibrary::SpawnSystemAtLocation( this, PickupEffect, GetActorLocation(), GetActorRotation() ); } Super::Destroyed(); }