// Project Sword & Gun Copyright © 2021 Kevin Poretti

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "Weapons/SNGMeleeWeaponBase.h"
#include "Weapons/SNGRangedWeaponBase.h"

#include "SNGWeaponInventoryComponent.generated.h"


UCLASS( ClassGroup=(SwordNGun), meta=(BlueprintSpawnableComponent) )
class SWORDNGUN_API USNGWeaponInventoryComponent : public UActorComponent
{
	GENERATED_BODY()

public:	
	// Sets default values for this component's properties
	USNGWeaponInventoryComponent();

	UFUNCTION(BlueprintCallable)
	int32 GetNumRangedWeapons();

	UFUNCTION(BlueprintCallable)
	int32 GetCurrentRangedWeaponIndex();
	
	UFUNCTION(BlueprintCallable)
	ASNGRangedWeaponBase* GetCurrentRangedWeapon();

	UFUNCTION(BlueprintCallable)
	ASNGRangedWeaponBase* SetCurrentRangedWeapon(int32 WeaponIndex);

	UFUNCTION(BlueprintCallable)
    int32 GetNumMeleeWeapons();
	
	UFUNCTION(BlueprintCallable)
	int32 GetCurrentMeleeWeaponIndex();
	
	UFUNCTION(BlueprintCallable)
	ASNGMeleeWeaponBase* GetCurrentMeleeWeapon();

	UFUNCTION(BlueprintCallable)
    ASNGMeleeWeaponBase* SetCurrentMeleeWeapon(int32 WeaponIndex);
	
protected:
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Ranged Weapons")
	TArray<TSubclassOf<ASNGRangedWeaponBase>> RangedWeaponClasses;

	UPROPERTY(BlueprintReadOnly, Category="Ranged Weapons")
	TArray<ASNGRangedWeaponBase*> RangedWeapons;

	uint32 CurrRangedWeaponIdx;

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Melee Weapons")
	TArray<TSubclassOf<ASNGMeleeWeaponBase>> MeleeWeaponClasses;

	UPROPERTY(BlueprintReadOnly, Category="Melee Weapons")
	TArray<ASNGMeleeWeaponBase*> MeleeWeapons;

	uint32 CurrMeleeWeaponIdx;
	
	// Called when the game starts
	virtual void BeginPlay() override;		
};
