// 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 AMapObject; class AAdventurePlayerController; 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 BaseTileClass; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Config") TSubclassOf 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(BlueprintReadOnly, Category = "Generation") TArray Grid; UPROPERTY(BlueprintReadWrite, EditAnywhere) TMap MapObjects; UPROPERTY(BlueprintReadOnly) TMap MapObjectsByID; int32 IncID = -1; UFUNCTION(BlueprintCallable, Category = "Runtime") int32 GridIndex(int32 q, int32 r); UFUNCTION(BlueprintCallable, Category = "Runtime") AHexTile* RandomHex(); UFUNCTION(BlueprintCallable, Category = "Runtime") TArray Neighbors(AHexTile* OfHex); UFUNCTION(BlueprintCallable, Category = "Runtime") TArray BreadthFirstSearch(AHexTile* Start, int32 Radius); UFUNCTION(BlueprintCallable, Category = "Runtime") TArray AStar(AHexTile* Start, AHexTile* Goal); UFUNCTION(BlueprintCallable, Category = "Runtime") TArray LinkPath(AHexTile* Start, AHexTile* Goal); // Cardinal direction vectors TPair N = TPair(1, -2); //diag TPair NE = TPair(1, -1); TPair ENE = TPair(2, -1); //diag TPair E = TPair(1, 0); TPair ESE = TPair(1, 1); //diag TPair SE = TPair(0, 1); TPair S = TPair(-1, 2); //diag TPair SW = TPair(-1, 1); TPair WSW = TPair(-2, 1); //diag TPair W = TPair(-1, 0); TPair WNW = TPair(-1, -1); //diag TPair NW = TPair(0, -1); protected: // Called when the game starts or when spawned virtual void BeginPlay() override; };