using Sirenix.OdinInspector;
using UnityEngine;
namespace Cielonos.MainGame
{
///
/// Submodule 是普通 C# 逻辑对象,不是 Unity Component。
/// Submodule 可以作为 owner class 的 nested class,用类型层级表达归属关系。
/// Submodule 不允许继承 MonoBehaviour / SerializedMonoBehaviour,也不应直接挂载到 GameObject。
/// 需要 Unity 生命周期、Inspector 组件绑定或 prefab/scene script 引用的逻辑,应使用顶层 Subcontroller。
///
///
/// 子模块通用接口。允许子模块通过继承其他类(如动作播放器)来避免单继承限制。
///
public interface ISubmodule
{
T Owner { get; set; }
}
public class SubmoduleBase : ISubmodule
{
[HideInInspector]
protected T owner;
public T Owner => owner;
T ISubmodule.Owner
{
get => Owner;
set => owner = value;
}
public SubmoduleBase(T owner)
{
this.owner = owner;
}
public void SetOwner(T newOwner)
{
this.owner = newOwner;
}
}
}