File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed
Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ UDoorType::UDoorType()
1717Color = FColor::Blue;
1818Description = FText::FromString (TEXT (" No Description" ));
1919#endif
20+ bCompatibleWithItself = true ;
2021}
2122
2223FVector UDoorType::GetSize (const UDoorType* DoorType)
@@ -33,3 +34,18 @@ FColor UDoorType::GetColor(const UDoorType* DoorType)
3334{
3435return IsValid (DoorType) ? DoorType->Color : Dungeon::DefaultDoorColor ();
3536}
37+
38+ bool UDoorType::AreCompatible (const UDoorType* A, const UDoorType* B)
39+ {
40+ // If both are null, they are compatible
41+ if (!IsValid (A) && !IsValid (B))
42+ return true ;
43+
44+ // If only one of them is null, they are not compatible
45+ if (!IsValid (A) || !IsValid (B))
46+ return false ;
47+
48+ if (A == B)
49+ return A->bCompatibleWithItself ;
50+ return A->Compatibility .Contains (B) || B->Compatibility .Contains (A);
51+ }
Original file line number Diff line number Diff line change @@ -228,7 +228,7 @@ bool FDoorDef::operator==(const FDoorDef& Other) const
228228
229229bool FDoorDef::AreCompatible (const FDoorDef& A, const FDoorDef& B)
230230{
231- return A.Type == B.Type ;
231+ return UDoorType::AreCompatible ( A.Type , B.Type ) ;
232232}
233233
234234FVector FDoorDef::GetDoorSize () const
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ class PROCEDURALDUNGEON_API UDoorType : public UDataAsset
3333// Returns the door color from the door type asset,
3434// or the default door color in plugin's settings if no door type defined.
3535static FColor GetColor (const UDoorType* DoorType);
36+
37+ // Returns true if one of the door type is explicitely set to be compatible with the other.
38+ static bool AreCompatible (const UDoorType* A, const UDoorType* B);
3639
3740protected:
3841// Size of the door bounds, only used by the debug draw as a visual hint for designers and artists.
@@ -52,4 +55,12 @@ class PROCEDURALDUNGEON_API UDoorType : public UDataAsset
5255UPROPERTY (EditInstanceOnly, Category = " Door Type" )
5356FText Description;
5457#endif
58+
59+ // Can this door type be connected with itself?
60+ UPROPERTY (EditInstanceOnly, Category = " Door Type" )
61+ bool bCompatibleWithItself;
62+
63+ // Which door types are compatible with this one
64+ UPROPERTY (EditInstanceOnly, Category = " Door Type" )
65+ TArray<UDoorType*> Compatibility;
5566};
You can’t perform that action at this time.
0 commit comments