28 lines
698 B
C#
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;
|
|
}
|
|
|
|
}
|