using System; using System.Collections; using System.Collections.Generic; using BITKit; using BITKit.Entities; using BITKit.Entities.Player; using UnityEngine; namespace BITFALL.Scenes { public class PortalArea : MonoBehaviour { private static readonly IntervalUpdate _CD = new(1); [SerializeField] private Transform area; [SerializeField] private Transform nextArea; private void OnTriggerEnter(Collider other) { if (other.TryGetComponent(out var player) is false) return; if (player.As().TryGetComponent(out var movement) is false) return; if (_CD.AllowUpdate is false) return; var pos = area.InverseTransformPoint(movement.Position); var nextPos = nextArea.TransformPoint(pos); movement.Position = nextPos; BIT4Log.Log($"Teleported to next area:{nextArea.name}"); } } }