Files
HauntedBloodlines/Assets/Scripts/LoopChangeTeleportation.cs
2025-05-29 22:31:40 +03:00

28 lines
698 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoopChangeTeleportation : MonoBehaviour
{
[SerializeField] private LoopedRoom _loopedRoom;
public Transform _newTeleportPOS;
private bool UpdatedTeleportPOS;
private void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "Player" && !UpdatedTeleportPOS)
{
UpdateRoomTeleportPOS();
UpdatedTeleportPOS = true;
}
}
public void UpdateRoomTeleportPOS()
{
_loopedRoom._LoopTeleportPoint.position = _newTeleportPOS.position;
_loopedRoom._LoopTeleportPoint.rotation = _newTeleportPOS.rotation;
}
}