comment pass
This commit is contained in:
@@ -7,6 +7,9 @@ using UnityEngine;
|
||||
|
||||
namespace EscapeRoomEngine.Portal.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The portal is a specific type of <see cref="DoorState"/> for seamless transitions between spaces.
|
||||
/// </summary>
|
||||
public class Portal : DoorState
|
||||
{
|
||||
public static readonly Matrix4x4 HalfRotation = Matrix4x4.Rotate(Quaternion.Euler(0, 180, 0));
|
||||
@@ -24,6 +27,9 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
/// </summary>
|
||||
[BoxGroup("Internal")] public Transform portalTransform;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this portal is connected is determined by whether the reference to its linked portal is set.
|
||||
/// </summary>
|
||||
internal bool Connected => linkedPortal != null;
|
||||
internal readonly List<PortalDriver> closePortalDrivers = new();
|
||||
|
||||
@@ -70,6 +76,9 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Begin tracking a portal driver that came close to this portal and might need to be teleported.
|
||||
/// </summary>
|
||||
internal void StartTrackingDriver(PortalDriver portalDriver, int entrySide)
|
||||
{
|
||||
closePortalDrivers.Add(portalDriver);
|
||||
@@ -77,12 +86,18 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
portalDriver.entrySide = entrySide;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// End tracking a portal driver that distanced itself from this portal or was teleported to the linked portal.
|
||||
/// </summary>
|
||||
internal void StopTrackingDriver(PortalDriver portalDriver)
|
||||
{
|
||||
closePortalDrivers.Remove(portalDriver);
|
||||
portalDriver.DisableClone(linkedPortal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculate which side of the portal plane a transform is.
|
||||
/// </summary>
|
||||
internal int CalculateSide(Transform portalDriverTransform)
|
||||
{
|
||||
return Math.Sign(Vector3.Dot(portalTransform.forward, portalDriverTransform.position - portalTransform.position));
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace EscapeRoomEngine.Portal.Runtime
|
||||
private void Awake()
|
||||
{
|
||||
// get player camera
|
||||
_player = Player.Current;
|
||||
_player = Player.Instance;
|
||||
|
||||
// get portal camera
|
||||
_camera = GetComponent<Camera>();
|
||||
|
||||
@@ -4,6 +4,9 @@ using UnityEngine;
|
||||
|
||||
namespace EscapeRoomEngine.Portal.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The portal collider is responsible for detecting <see cref="PortalDriver"/>s that come close to this portal.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Collider))]
|
||||
public class PortalCollider : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -4,6 +4,9 @@ using LogType = EscapeRoomEngine.Engine.Runtime.Utilities.LogType;
|
||||
|
||||
namespace EscapeRoomEngine.Portal.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// A portal driver is any object that can be teleported by a portal like the player, their hands or objects.
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Collider), typeof(Rigidbody))]
|
||||
public class PortalDriver : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -4,6 +4,9 @@ using UnityEngine.XR.Interaction.Toolkit;
|
||||
|
||||
namespace EscapeRoomEngine.Portal.Runtime
|
||||
{
|
||||
/// <summary>
|
||||
/// The clone of a <see cref="PortalDriver"/> is a copy of it that was stripped of most of its components. Its position is updated by the driver.
|
||||
/// </summary>
|
||||
public class PortalDriverClone : MonoBehaviour
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user