BITFALL/Assets/Artists/Scripts/GameMode/UnityInfoEntityStart.cs

29 lines
763 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
namespace BITFALL.GameMode
{
public abstract class UnityInfoEntityStart<T> : MonoBehaviour
{
[SerializeField] private int property;
public int Property=> property;
public float3 Position { get;private set; }
public quaternion Rotation{ get;private set; }
public float4x4 Matrix{ get;private set; }
protected virtual void OnEnable()
{
var transform1 = transform;
Position = transform1.position;
Rotation = transform1.rotation;
Matrix = transform1.localToWorldMatrix;
if (this is T t) NodeQuery.Register<T>(t);
}
protected virtual void OnDisable()
{
if (this is T t) NodeQuery.Unregister<T>(t);
}
}
}