2022-01-11 11:07:17 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
#include "GameFramework/Actor.h"
|
|
|
|
|
|
|
|
#include "HexTile.generated.h"
|
|
|
|
|
|
|
|
class USceneComponent;
|
|
|
|
class UStaticMeshComponent;
|
2022-01-13 16:34:06 +01:00
|
|
|
class AAdventureMap;
|
2022-06-10 16:15:12 +02:00
|
|
|
class AMapObject;
|
2022-06-01 20:25:33 +02:00
|
|
|
class AStarFog;
|
2022-01-11 11:07:17 +01:00
|
|
|
class AAdventurePlayerController;
|
|
|
|
|
|
|
|
UCLASS()
|
|
|
|
class FRAY_API AHexTile : public AActor
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Sets default value for this actor's properties
|
|
|
|
AHexTile();
|
|
|
|
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Config")
|
|
|
|
float TileSize;
|
2022-06-01 20:25:33 +02:00
|
|
|
//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Config")
|
|
|
|
// USceneComponent* SceneComponent;
|
2022-01-16 18:33:43 +01:00
|
|
|
UPROPERTY(BlueprintReadWrite, Category = "Config")
|
|
|
|
AAdventureMap* MapRef;
|
2022-06-01 20:25:33 +02:00
|
|
|
UPROPERTY(BlueprintReadWrite, Category = "Config")
|
|
|
|
AStarFog* CoveringFog;
|
|
|
|
|
2022-01-11 11:07:17 +01:00
|
|
|
|
2022-01-13 16:54:37 +01:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "debug")
|
2022-01-11 11:07:17 +01:00
|
|
|
FVector Corner(int32 i);
|
|
|
|
UFUNCTION()
|
|
|
|
void FillCornersArray();
|
2022-01-16 18:33:43 +01:00
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "debug")
|
|
|
|
TArray<FVector> Corners;
|
2022-01-11 11:07:17 +01:00
|
|
|
|
2022-01-16 18:33:43 +01:00
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
|
2022-01-11 11:07:17 +01:00
|
|
|
int32 Q;
|
2022-01-16 18:33:43 +01:00
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
|
2022-01-11 11:07:17 +01:00
|
|
|
int32 R;
|
2022-01-16 18:33:43 +01:00
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
|
2022-01-11 11:07:17 +01:00
|
|
|
int32 Index;
|
2022-01-16 18:33:43 +01:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Coordinates")
|
2022-01-13 16:54:37 +01:00
|
|
|
int32 Distance(AHexTile* ToHex);
|
|
|
|
|
2022-01-16 18:33:43 +01:00
|
|
|
// Pathfinding
|
2022-02-03 01:11:06 +01:00
|
|
|
UPROPERTY(BlueprintReadWrite)
|
2022-06-08 11:39:41 +02:00
|
|
|
int32 MoveCost = 1;
|
2022-01-18 20:09:37 +01:00
|
|
|
UPROPERTY()
|
2022-06-08 11:39:41 +02:00
|
|
|
int32 FCost;
|
2022-01-18 20:09:37 +01:00
|
|
|
UPROPERTY()
|
2022-06-08 11:39:41 +02:00
|
|
|
int32 GCost = 9999;
|
2022-01-18 20:09:37 +01:00
|
|
|
UPROPERTY()
|
2022-06-08 11:39:41 +02:00
|
|
|
int32 HCost;
|
|
|
|
UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = "Runtime")
|
|
|
|
AHexTile* CameFrom;
|
2022-01-16 18:33:43 +01:00
|
|
|
|
2022-01-24 21:26:06 +01:00
|
|
|
// MapObject Placement
|
|
|
|
UPROPERTY(BlueprintReadWrite, VisibleAnywhere)
|
|
|
|
bool bFree = true;
|
2022-06-10 16:15:12 +02:00
|
|
|
UPROPERTY(BlueprintReadOnly, VisibleInstanceOnly)
|
|
|
|
AMapObject* MapObject;
|
2022-06-01 20:25:33 +02:00
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly)
|
2022-06-10 16:15:12 +02:00
|
|
|
bool bCanActivate = false;
|
2022-06-01 20:25:33 +02:00
|
|
|
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly)
|
2022-06-10 16:15:12 +02:00
|
|
|
bool bEvent = false;
|
2022-01-24 21:26:06 +01:00
|
|
|
|
2022-01-16 18:33:43 +01:00
|
|
|
FORCEINLINE bool operator == (const AHexTile &Other)
|
|
|
|
{
|
|
|
|
if (this->Q == Other.Q && this->R == Other.R) { return true; }
|
|
|
|
else { return false; }
|
|
|
|
}
|
|
|
|
FORCEINLINE bool operator != (const AHexTile &Other)
|
|
|
|
{
|
|
|
|
if (this->Q == Other.Q && this->R == Other.R) { return false; }
|
|
|
|
else { return true; }
|
|
|
|
}
|
|
|
|
|
2022-01-11 11:07:17 +01:00
|
|
|
protected:
|
|
|
|
// Called when the game starts or when spawned
|
|
|
|
virtual void BeginPlay() override;
|
|
|
|
};
|
|
|
|
|