// Project Lab - NHTV Igad

#pragma once

#include "NetworkDoodad.h"
#include "NetworkPlayer.h"
#include "NetworkTrigger.generated.h"

UENUM(BlueprintType)
enum class OpenMode : uint8
{
	NoKeyRequired = 0,
	BossRoomKeyParts = 1,
	TreasureRoomKey = 2,
};

UCLASS()
class UNREALPROJECT_API ANetworkTrigger : public ANetworkDoodad
{
	GENERATED_BODY()

public:
	ANetworkTrigger();
	virtual void BeginPlay() override;
	
	UPROPERTY(EditAnywhere, Category = "Switch Components")
	TArray<class ANetworkDoor*> doorsToOpen;
	UPROPERTY(EditAnywhere, Category = "Switch Components")
	TArray<class ACreatureSpawn*> creaturesToSpawn;
	UPROPERTY(EditAnywhere, Category = "Switch Components")
	float cooldown;
	UPROPERTY(EditAnywhere, Category = "Switch Components")
	OpenMode openMode;
	
	UFUNCTION()
	void OnOverlapBegin(class AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
	
	virtual void Tick(float DeltaSeconds) override;

private:
	float m_elapsedTime;

	UPROPERTY(EditAnywhere, Category = "Switch Components")
	class UBoxComponent* cubeCollider;

	UPROPERTY(EditAnywhere, Category = "Switch Components")
	class UStaticMeshComponent* meshComponent;
	UPROPERTY(EditAnywhere, Category = "Switch Components")
	class UNetworkSwitchComponent* visualizerComponent;
	UPROPERTY(EditAnywhere, Category = "Switch Components")
	ToggleType toggleMode;
};
