unreal/HexTile.h

83 lines
2.1 KiB
C
Raw Normal View History

2022-01-11 11:07:17 +01:00
// Fill out your copyright notice in the Description page of Project Settings.
#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-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;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Config")
2022-01-11 11:07:17 +01:00
USceneComponent* SceneComponent;
UPROPERTY(BlueprintReadWrite, Category = "Config")
AAdventureMap* MapRef;
2022-01-11 11:07:17 +01:00
UFUNCTION(BlueprintCallable, Category = "debug")
2022-01-11 11:07:17 +01:00
FVector Corner(int32 i);
UFUNCTION()
void FillCornersArray();
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "debug")
TArray<FVector> Corners;
2022-01-11 11:07:17 +01:00
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
2022-01-11 11:07:17 +01:00
int32 Q;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
2022-01-11 11:07:17 +01:00
int32 R;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Coordinates")
2022-01-11 11:07:17 +01:00
int32 Index;
UFUNCTION(BlueprintCallable, Category = "Coordinates")
int32 Distance(AHexTile* ToHex);
// Pathfinding
UPROPERTY(BlueprintReadWrite, Category = "Movement")
2022-01-28 21:58:04 +01:00
float MoveCost = 10;
UPROPERTY(BlueprintReadWrite, VisibleInstanceOnly, Category = "Movement")
AHexTile* CameFrom;
UPROPERTY()
2022-01-28 21:58:04 +01:00
float FCost;
UPROPERTY()
2022-01-28 21:58:04 +01:00
float GCost;
UPROPERTY()
2022-01-28 21:58:04 +01:00
float HCost;
// MapObject Placement
UPROPERTY(BlueprintReadWrite, VisibleAnywhere)
bool bFree = true;
2022-01-29 20:54:35 +01:00
UPROPERTY(BlueprintReadWrite, EditAnywhere)
bool bTouchable = false;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
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; }
}
2022-01-11 11:07:17 +01:00
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
};