unreal/HexTile.h

89 lines
2.3 KiB
C++

#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "HexTile.generated.h"
class USceneComponent;
class UStaticMeshComponent;
class AAdventureMap;
class AStarFog;
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;
//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Config")
// USceneComponent* SceneComponent;
UPROPERTY(BlueprintReadWrite, Category = "Config")
AAdventureMap* MapRef;
UPROPERTY(BlueprintReadWrite, Category = "Config")
AStarFog* CoveringFog;
UFUNCTION(BlueprintCallable, Category = "debug")
FVector Corner(int32 i);
UFUNCTION()
void FillCornersArray();
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "debug")
TArray<FVector> Corners;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
int32 Q;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
int32 R;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
int32 Index;
UFUNCTION(BlueprintCallable, Category = "Coordinates")
int32 Distance(AHexTile* ToHex);
// Pathfinding
UPROPERTY(BlueprintReadWrite)
float MoveCost = 10;
UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = "Runtime")
AHexTile* CameFrom;
UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = "Runtime")
AHexTile* LeadsTo;
UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = "Runtime")
bool bDiagMove = false;
UPROPERTY()
float FCost;
UPROPERTY()
float GCost;
UPROPERTY()
float HCost = 9999;
// MapObject Placement
UPROPERTY(BlueprintReadWrite, VisibleAnywhere)
bool bFree = true;
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly)
bool bTouchable = false;
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly)
bool bSteptivatable = false;
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; }
}
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
};