Skip to content

Instantly share code, notes, and snippets.

@AG-Dan
Last active February 20, 2021 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AG-Dan/89db2d73d9d5967543b0748b9a10e245 to your computer and use it in GitHub Desktop.
Save AG-Dan/89db2d73d9d5967543b0748b9a10e245 to your computer and use it in GitHub Desktop.
using DunGen;
using UnityEngine;
/// <summary>
/// Custom doorway connection logic for rooms and corridors:
/// Room + Corridor: Allowed
/// Corridor + Corridor: Allowed
/// Room + Room: Not Allowed
///
/// </summary>
public class CustomDoorConnectionLogic : MonoBehaviour
{
public DoorwaySocket RoomSocket = null;
public DoorwaySocket CorridorSocket = null;
private void Awake()
{
DoorwaySocket.CustomSocketConnectionDelegate += CanSocketsConnect;
}
private void OnDestroy()
{
DoorwaySocket.CustomSocketConnectionDelegate -= CanSocketsConnect;
}
private bool CanSocketsConnect(DoorwaySocket a, DoorwaySocket b)
{
if (a == RoomSocket && b == RoomSocket)
return false;
else
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment