number portals

This commit is contained in:
2023-02-14 13:34:11 +01:00
parent e8ae057754
commit c5f3bb3299

View File

@@ -13,6 +13,8 @@ namespace EscapeRoomEngine.Portal.Runtime
public class Portal : DoorState
{
public static readonly Matrix4x4 HalfRotation = Matrix4x4.Rotate(Quaternion.Euler(0, 180, 0));
private static int _portalCounter;
/// <summary>
/// The portal that is connected with this one.
@@ -31,10 +33,14 @@ namespace EscapeRoomEngine.Portal.Runtime
/// Whether this portal is connected is determined by whether the reference to its linked portal is set.
/// </summary>
internal bool Connected => linkedPortal != null;
[ShowNativeProperty] internal int PortalNumber { get; private set; }
internal readonly List<PortalDriver> closePortalDrivers = new();
protected virtual void Awake()
{
PortalNumber = _portalCounter++;
DoorEvent += (_, type) =>
{
// ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault