31 lines
725 B
C#
31 lines
725 B
C#
using UnityEngine;
|
|
|
|
[ExecuteInEditMode, DefaultExecutionOrder(1)]
|
|
public class Portal : MonoBehaviour
|
|
{
|
|
[SerializeField, Range(0, 2)] private int _id;
|
|
[SerializeField, Range(0, 1)] private float _oval;
|
|
|
|
public int ID => _id;
|
|
public float Oval => _oval;
|
|
|
|
private void OnDrawGizmos()
|
|
{
|
|
Gizmos.matrix = transform.localToWorldMatrix;
|
|
Gizmos.color = Color.cyan;
|
|
Gizmos.DrawWireCube(Vector3.zero, new Vector3(1, 1, 0));
|
|
}
|
|
|
|
void OnEnable()
|
|
{
|
|
if (PortalManager.Instance)
|
|
PortalManager.Instance.RegisterPortal(this);
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
if (PortalManager.Instance)
|
|
PortalManager.Instance.UnregisterPortal(this);
|
|
}
|
|
}
|