correctly delete old rooms

This commit is contained in:
2022-12-07 15:41:00 +01:00
parent 4f886fc0b1
commit d36d33ca96
23 changed files with 222 additions and 242 deletions

View File

@@ -44,20 +44,24 @@ namespace EscapeRoomEngine.Portal.Runtime
protected void Start()
{
if (hasClone)
{
clone = PortalDriverClone.Create(this);
}
}
private void Update()
{
if (hasClone && clone.gameObject.activeSelf)
{
clone.UpdatePosition(transform);
}
}
public void EnableClone(Portal at)
{
if (hasClone)
{
Logger.Log($"Enabled {clone}", LogType.Portals);
Logger.Log($"Enabled {clone} at {at}", LogType.Portals);
clone.portal = at;
clone.gameObject.SetActive(true);
@@ -68,7 +72,7 @@ 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);
Logger.Log($"Disabled {clone} at {clone.portal}", LogType.Portals);
clone.portal = null;
clone.gameObject.SetActive(false);