number portals

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

View File

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