using System;
using UnityEngine;
namespace AlicizaX.Runtime
{
public abstract class GameFrameworkComponent : MonoBehaviour
{
///
/// 是否自动注册
///
protected bool IsAutoRegister { get; set; } = true;
///
/// 实现类的类型
///
protected Type ImplementationComponentType = null;
///
/// 接口类的类型
///
protected Type InterfaceComponentType = null;
///
/// 游戏框架组件类型。
///
[HideInInspector] [SerializeField] protected string componentType = string.Empty;
///
/// 游戏框架组件初始化。
///
protected virtual void Awake()
{
GameEntry.RegisterComponent(this);
if (IsAutoRegister)
{
GameFrameworkGuard.NotNull(ImplementationComponentType, nameof(ImplementationComponentType));
GameFrameworkGuard.NotNull(InterfaceComponentType, nameof(InterfaceComponentType));
SysModuleCenter.RegisterModule(InterfaceComponentType, ImplementationComponentType);
}
}
}
}