156 - Health Pickup

This commit is contained in:
Kingsmedia 2022-05-22 23:48:23 +02:00
parent bc681ab8a6
commit 5eec76005b
100 changed files with 90 additions and 4 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,8 +9,6 @@
void AAmmoPickup::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult& SweepResult)
{
UE_LOG(LogTemp, Warning, TEXT("AmmoPickup Overlap"));
Super::OnSphereOverlap(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepResult);
ABlasterCharacter* BlasterCharacter = Cast<ABlasterCharacter>(OtherActor);

View File

@ -23,7 +23,7 @@ protected:
int32 OtherBodyIndex,
bool bFromSweep,
const FHitResult& SweepResult
);
) override;
private:
UPROPERTY(EditAnywhere)

View File

@ -0,0 +1,44 @@
// 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<UNiagaraComponent>(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<ABlasterCharacter>(OtherActor);
if (BlasterCharacter)
{
}
Destroy();
}
void AHealthPickup::Destroyed()
{
if (PickupEffect)
{
UNiagaraFunctionLibrary::SpawnSystemAtLocation(
this,
PickupEffect,
GetActorLocation(),
GetActorRotation()
);
}
Super::Destroyed();
}

View File

@ -0,0 +1,44 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Pickup.h"
#include "HealthPickup.generated.h"
/**
*
*/
UCLASS()
class BLASTER_API AHealthPickup : public APickup
{
GENERATED_BODY()
public:
AHealthPickup();
virtual void Destroyed() override;
protected:
virtual void OnSphereOverlap(
UPrimitiveComponent* OverlappedComponent,
AActor* OtherActor,
UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex,
bool bFromSweep,
const FHitResult& SweepResult
) override;
private:
UPROPERTY(EditAnywhere)
float HealAmount = 100.f;
UPROPERTY(EditAnywhere)
float HealingTime = 5.f;
UPROPERTY(VisibleAnywhere)
class UNiagaraComponent* PickupEffectComponent;
UPROPERTY(EditAnywhere)
class UNiagaraSystem* PickupEffect;
};

View File

@ -44,7 +44,7 @@ void APickup::BeginPlay()
void APickup::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult& SweepResult)
{
UE_LOG(LogTemp, Warning, TEXT("Pickup Overlap"));
}
void APickup::Tick(float DeltaTime)