66 lines
1.5 KiB
C#
66 lines
1.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace SepCore.Entity
|
|
{
|
|
[Serializable]
|
|
public abstract class EntityDataBase
|
|
{
|
|
[SerializeField] private string m_AssetName = string.Empty;
|
|
|
|
[SerializeField] private int _id = 0;
|
|
|
|
[SerializeField] private int _typeId = 0;
|
|
|
|
[SerializeField] private Vector3 _position = Vector3.zero;
|
|
|
|
[SerializeField] private Quaternion _rotation = Quaternion.identity;
|
|
|
|
public EntityDataBase(string assetName, int entityId)
|
|
{
|
|
m_AssetName = assetName;
|
|
_id = entityId;
|
|
}
|
|
|
|
public EntityDataBase(int entityId, int typeId)
|
|
{
|
|
m_AssetName = typeId.ToString();
|
|
_id = entityId;
|
|
_typeId = typeId;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 实体资源名称。
|
|
/// </summary>
|
|
public string AssetName => m_AssetName;
|
|
|
|
/// <summary>
|
|
/// 实体编号。
|
|
/// </summary>
|
|
public int Id => _id;
|
|
|
|
/// <summary>
|
|
/// 实体类型编号(向后兼容)。
|
|
/// </summary>
|
|
public int TypeId => _typeId;
|
|
|
|
/// <summary>
|
|
/// 实体位置。
|
|
/// </summary>
|
|
public Vector3 Position
|
|
{
|
|
get => _position;
|
|
set => _position = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 实体朝向。
|
|
/// </summary>
|
|
public Quaternion Rotation
|
|
{
|
|
get => _rotation;
|
|
set => _rotation = value;
|
|
}
|
|
}
|
|
}
|