vampires/Source/vampires/Weapons/ProjectileWeapon.h

64 lines
1.5 KiB
C
Raw Normal View History

2025-02-05 23:12:03 +00:00
// Louis Hobbs | 2024-2025
2024-07-31 14:19:50 +01:00
#pragma once
#include "CoreMinimal.h"
2024-11-13 23:47:47 +00:00
#include "vampires/Weapon.h"
2024-07-31 14:19:50 +01:00
#include "ProjectileWeapon.generated.h"
class UProjectileDataAsset;
2024-11-13 23:47:47 +00:00
class AProjectile;
class UBoxComponent;
2024-07-31 14:19:50 +01:00
/**
*
*/
UCLASS()
class VAMPIRES_API AProjectileWeapon : public AWeapon
{
GENERATED_BODY()
2024-07-31 14:19:50 +01:00
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
UBoxComponent* BoxComponent = nullptr;
2024-07-31 14:19:50 +01:00
UPROPERTY(EditAnywhere, Category = "Weapon Properties")
TObjectPtr<UProjectileDataAsset> ProjectileTemplate = nullptr;
2024-07-31 14:19:50 +01:00
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
int ProjectilesPerActivation = 1;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
float ProjectileSpawningDelay = 0.25f;
2024-07-31 14:19:50 +01:00
protected:
TArray<AActor*> OverlappedEnemies = TArray<AActor*>();
FTimerHandle FireProjectileTimerHandler;
private:
int remainingProjectilesToSpawn = 0;
2024-07-31 14:19:50 +01:00
public:
AProjectileWeapon();
2024-07-31 14:19:50 +01:00
protected:
virtual void BeginPlay() override;
2024-07-31 14:19:50 +01:00
public:
UFUNCTION()
void OnWeaponBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
const FHitResult& SweepResult);
2024-07-31 14:19:50 +01:00
UFUNCTION()
void OnWeaponEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,
int32 OtherBodyIndex);
virtual void FireWeaponAction_Implementation() override;
protected:
UFUNCTION()
virtual void FireProjectile();
2024-07-31 14:19:50 +01:00
};