61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "AdventureMap.generated.h"
|
|
|
|
class AHexTile;
|
|
class AAdventureCharacter;
|
|
|
|
UCLASS()
|
|
class FRAY_API AAdventureMap : public AActor
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this actor's properties
|
|
AAdventureMap();
|
|
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Config")
|
|
TSubclassOf<AHexTile> BaseTileClass;
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Config")
|
|
TSubclassOf<ACharacter> BasePartyCharacterClass;
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Config")
|
|
int32 GridSize = 100; // squared is the number of Tiles
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Config")
|
|
int32 TileSize = 100;
|
|
UPROPERTY()
|
|
UWorld* World;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Generation")
|
|
void MakeGrid();
|
|
UPROPERTY(BlueprintReadOnly, Category = "Generation")
|
|
bool bHexGridReady;
|
|
UPROPERTY(VisibleInstanceOnly, BlueprintReadWrite, Category = "Generation")
|
|
TArray<AHexTile*> Grid;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Runtime")
|
|
int32 GridIndex(int32 q, int32 r);
|
|
UFUNCTION(BlueprintCallable, Category = "Runtime")
|
|
AHexTile* RandomHex();
|
|
UFUNCTION(BlueprintCallable, Category = "Runtime")
|
|
TArray<AHexTile*> Neighbors(AHexTile* OfHex);
|
|
UFUNCTION(BlueprintCallable, Category = "Runtime")
|
|
TArray<AHexTile*> AStar(AHexTile* Start, AHexTile* Goal);
|
|
UFUNCTION(BlueprintCallable, Category = "Runtime")
|
|
TArray<AHexTile*> LinkPath(AHexTile* Start, AHexTile* Goal);
|
|
|
|
|
|
// Player spawn section
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
|
APawn* CameraPawn;
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
|
|
AAdventureCharacter* PlayerCharacter;
|
|
|
|
protected:
|
|
// Called when the game starts or when spawned
|
|
virtual void BeginPlay() override;
|
|
};
|