small fixes in portal clones and Terminal B

This commit is contained in:
2022-11-28 20:52:00 +01:00
parent 8a708e27b8
commit efe3cceba1
8 changed files with 131 additions and 40 deletions

View File

@@ -1,5 +1,7 @@
using System;
using UnityEngine;
using Logger = EscapeRoomEngine.Engine.Runtime.Utilities.Logger;
using LogType = EscapeRoomEngine.Engine.Runtime.Utilities.LogType;
namespace EscapeRoomEngine.Portal.Runtime
{
@@ -57,6 +59,8 @@ namespace EscapeRoomEngine.Portal.Runtime
{
if (hasClone)
{
Logger.Log($"Enabled {clone}", LogType.Portals);
clone.portal = at;
clone.gameObject.SetActive(true);
}
@@ -66,6 +70,8 @@ namespace EscapeRoomEngine.Portal.Runtime
{
if (hasClone && at.Equals(clone.portal)) // don't disable clones that are already at a different portal
{
Logger.Log($"Disabled {clone}", LogType.Portals);
clone.portal = null;
clone.gameObject.SetActive(false);
}
@@ -73,6 +79,8 @@ namespace EscapeRoomEngine.Portal.Runtime
public void Teleport(Portal from, Portal to)
{
Logger.Log($"Teleported {this} from {from} to {to}", LogType.Portals);
var m = to.portalTransform.localToWorldMatrix * Portal.HalfRotation *
from.portalTransform.worldToLocalMatrix * traveller.localToWorldMatrix;
traveller.SetPositionAndRotation(m.GetPosition(), m.rotation);