super-duper-spoon/Source/Shooter/Explosive.h

55 lines
1.6 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "BulletHitInterface.h"
#include "GameFramework/Actor.h"
#include "Explosive.generated.h"
class UParticleSystem;
class USoundCue;
class USphereComponent;
class UStaticMeshComponent;
UCLASS()
class SHOOTER_API AExplosive : public AActor, public IBulletHitInterface
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AExplosive();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
private:
/** Particles to spawn when hit by bullets */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true))
UParticleSystem* ExplosionParticles;
/** Sound to play when hit by bullets */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true))
USoundCue* ExplosionSound;
/** Mesh for the explosive */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Combat, meta = (AllowPrivateAccess = true))
UStaticMeshComponent* ExplosiveMesh;
/** Used to determine what actors overlap during explosion */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true))
USphereComponent* OverlapSphere;
/** Damage amount for explosive */
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true))
float Damage;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
virtual void BulletHit_Implementation(FHitResult HitResult, AActor* Shooter, AController* ShooterController) override;
};