#pragma once #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "EnemyProjectile.generated.h" UCLASS() class MYPROJECT3_API AEnemyProjectile : public AActor { GENERATED_BODY() public: AEnemyProjectile(); protected: virtual void BeginPlay() override; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components") class UStaticMeshComponent* ProjectileMesh; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components") class UProjectileMovementComponent* ProjectileMovement; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projectile") float ProjectileSpeed = 2500.0f; // Slightly slower than player projectiles UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projectile") float DamageAmount = 10.0f; // Less damage than player projectiles // Add a particle effect for impact UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Effects") class UParticleSystem* ImpactEffect; UFUNCTION() void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit); // Add an overlap handler for redundant collision detection UFUNCTION() void OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult); };