Skip to content

Commit

Permalink
Added plugin settings to customize the door debug arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
BenPyton committed Apr 8, 2024
1 parent e2fef37 commit ad1a274
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ UProceduralDungeonSettings::UProceduralDungeonSettings(const FObjectInitializer&
// Debug settings
DrawDebug = true;
ShowRoomOrigin = false;
bFlipDoorArrowSide = false;
DoorArrowLength = 300.0f;
DoorArrowHeadSize = 300.0f;
OnScreenPrintDebug = false;
PrintDebugDuration = 60.0f;

Expand Down
3 changes: 2 additions & 1 deletion Source/ProceduralDungeon/Private/ProceduralDungeonTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ void FDoorDef::DrawDebug(const UWorld* World, const FColor& Color, const FVector
if (isConnected)
{
// Arrow (there is a room on the other side OR in the editor preview)
DrawDebugDirectionalArrow(World, DoorPosition, DoorPosition + DoorRotation * FVector(300, 0, 0), 300, Color);
FVector ArrowVector = (Dungeon::FlipDoorArrow() ? -1.0f : 1.0f) * FVector(Dungeon::DoorArrowLength(), 0.0f, 0.0f);
DrawDebugDirectionalArrow(World, DoorPosition, DoorPosition + DoorRotation * ArrowVector, Dungeon::DoorArrowHeadSize(), Color);
}
else
{
Expand Down
18 changes: 18 additions & 0 deletions Source/ProceduralDungeon/Private/ProceduralDungeonUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ bool Dungeon::ShowRoomOrigin()
return Settings->ShowRoomOrigin;
}

bool Dungeon::FlipDoorArrow()
{
const UProceduralDungeonSettings* Settings = GetDefault<UProceduralDungeonSettings>();
return Settings->bFlipDoorArrowSide;
}

float Dungeon::DoorArrowLength()
{
const UProceduralDungeonSettings* Settings = GetDefault<UProceduralDungeonSettings>();
return Settings->DoorArrowLength;
}

float Dungeon::DoorArrowHeadSize()
{
const UProceduralDungeonSettings* Settings = GetDefault<UProceduralDungeonSettings>();
return Settings->DoorArrowHeadSize;
}

bool Dungeon::CanLoop()
{
const UProceduralDungeonSettings* Settings = GetDefault<UProceduralDungeonSettings>();
Expand Down
14 changes: 14 additions & 0 deletions Source/ProceduralDungeon/Public/ProceduralDungeonSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ class PROCEDURALDUNGEON_API UProceduralDungeonSettings : public UObject
UPROPERTY(EditAnywhere, config, Category = "Debug", meta = (EditCondition = "DrawDebug"))
bool ShowRoomOrigin;

// Flip side the arrow that shows door facing direction.
// True means that the arrow gets inside the room (opposite of door actor's forward).
// False means that the arrow goes outside the room (same as door actor's forward).
UPROPERTY(EditAnywhere, config, Category = "Debug", meta = (EditCondition = "DrawDebug"))
bool bFlipDoorArrowSide;

// Length of the door's debug arrow.
UPROPERTY(EditAnywhere, config, Category = "Debug", meta = (EditCondition = "DrawDebug"))
float DoorArrowLength;

// Size of the door's debug arrow head.
UPROPERTY(EditAnywhere, config, Category = "Debug", meta = (EditCondition = "DrawDebug"))
float DoorArrowHeadSize;

// Show some logs on the screen
UPROPERTY(EditAnywhere, config, Category = "Debug")
bool OnScreenPrintDebug;
Expand Down
3 changes: 3 additions & 0 deletions Source/ProceduralDungeon/Public/ProceduralDungeonUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ namespace Dungeon
bool PROCEDURALDUNGEON_API OccludeDynamicActors();
bool PROCEDURALDUNGEON_API DrawDebug();
bool PROCEDURALDUNGEON_API ShowRoomOrigin();
bool PROCEDURALDUNGEON_API FlipDoorArrow();
float PROCEDURALDUNGEON_API DoorArrowLength();
float PROCEDURALDUNGEON_API DoorArrowHeadSize();
bool PROCEDURALDUNGEON_API CanLoop();
ECollisionChannel PROCEDURALDUNGEON_API RoomObjectType();

Expand Down

0 comments on commit ad1a274

Please sign in to comment.