// Project Sword & Gun Copyright © 2021 Kevin Poretti

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Sound/SoundCue.h"
#include "SNGImpactEffect.generated.h"

UCLASS()
class SWORDNGUN_API ASNGImpactEffect : public AActor
{
	GENERATED_BODY()

public:
	UPROPERTY(BlueprintReadOnly)
	TEnumAsByte<EPhysicalSurface> ImpactSurface;
	
protected:
	/** Particle systems */
	
	/** Particle system to spawn when a specific surface->particle association doesn't exist */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* DefaultParticle;

	/** Particle when impacting flesh */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* FleshParticle;

	/** Particle when impacting vulnerable flesh (like the head) */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* FleshVulnerableParticle;
	
	/** Particle when impacting stone */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* StoneParticle;
	
	/** Particle when impacting dirt */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* DirtParticle;

	/** Particle when impacting water */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* WaterParticle;

	/** Particle when impacting metal */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* MetalParticle;

	/** Particle when impacting wood */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* WoodParticle;

	/** Particle when impacting glass */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* GlassParticle;

	/** Particle when impacting grass */
	UPROPERTY(EditDefaultsOnly, Category="Particles")
	UParticleSystem* GrassParticle;

	/** Sounds */

	/** Sound to play when a specific surface->sound association doesn't exist */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* DefaultSound;
	
	/** Sound when impacting flesh */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* FleshSound;

	/** Sound when impacting vulnerable flesh (like the head) */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* FleshVulnerableSound;
	
	/** Sound when impacting stone */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* StoneSound;

	/** Sound when impacting dirt */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* DirtSound;

	/** Sound when impacting water */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* WaterSound;

	/** Sound when impacting metal */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* MetalSound;

	/** Sound when impacting wood */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* WoodSound;
	
	/** Sound when impacting glass */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* GlassSound;

	/** Sound when impacting grass */
	UPROPERTY(EditDefaultsOnly, Category="Sounds")
	USoundCue* GrassSound;
	
	/** Spawn the effect */
	virtual void PostInitializeComponents() override;

	/**
	 *	Gets the particle effect associated with the surface type
	 *
	 *	@returns the particle system associated with the surface type
	 */
	UParticleSystem* GetImpactParticle() const;

	/**
	 *	Gets the sound effect associated with the surface type
	 *
	 *	@returns the sound effect associated with the surface type
	 */
	USoundCue* GetImpactSound() const;
};
