// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Ammo.generated.h"

UENUM(BlueprintType)
enum class EAmmoColour : uint8
{
	Red		UMETA(DisplayName = "Red"),
	Blue	UMETA(DisplayName = "Blue"),
};

USTRUCT(BlueprintType)
struct FSingleRound
{
	GENERATED_USTRUCT_BODY()

	FSingleRound();

	EAmmoColour GetRoundColor();
	void SetRoundColor(EAmmoColour NewColor);

	FString ToString();

	bool GetSpread();
	void SetSpread(bool NewSpread);

	EAmmoColour RoundColor;
	bool Spread;
};

UCLASS()
class GAMEJAMTEMPLATE_API AAmmo : public AActor
{
	GENERATED_BODY()
	
public:	

	AAmmo();

	virtual void Tick(float DeltaTime) override;

	UFUNCTION(BlueprintCallable)
	FString ToString();

	FSingleRound* GetLeftRound();
	FSingleRound* GetRightRound();

	class UPaperFlipbookComponent* GetLeftPaperFlipbook();
	class UPaperFlipbookComponent* GetRightPaperFlipbook();

protected:
	
	virtual void BeginPlay() override;

private:
	// The name of the object fetched by the UObjectBaseUtility::GetName method
	const FString ObjectName;

	// Left bullet
	FSingleRound LeftRound;

	// Right bullet
	FSingleRound RightRound;

	// The paper flipbook component holding the sprites.
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
	class UPaperFlipbookComponent* LeftPaperFlipbook;

	// The paper flipbook component holding the sprites.
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
	class UPaperFlipbookComponent* RightPaperFlipbook;
};
