2026-02-13 09:22:11 -05:00
|
|
|
using Sirenix.OdinInspector;
|
2025-11-25 08:19:33 -05:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Cielonos.MainGame
|
|
|
|
|
{
|
2026-06-05 04:21:00 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// 子模块通用接口。允许子模块通过继承其他类(如动作播放器)来避免单继承限制。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface ISubmodule<T>
|
|
|
|
|
{
|
|
|
|
|
T Owner { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-23 08:27:50 -04:00
|
|
|
[HideInEditorMode]
|
2026-06-05 04:21:00 -04:00
|
|
|
public class SubmoduleBase<T> : ISubmodule<T>
|
2025-11-25 08:19:33 -05:00
|
|
|
{
|
2026-02-13 09:22:11 -05:00
|
|
|
[HideInInspector]
|
|
|
|
|
public T owner;
|
2025-11-25 08:19:33 -05:00
|
|
|
|
2026-06-05 04:21:00 -04:00
|
|
|
// 显式接口实现以满足 ISubmodule 接口,保持原有 public 字段完整兼容性
|
|
|
|
|
T ISubmodule<T>.Owner
|
|
|
|
|
{
|
|
|
|
|
get => owner;
|
|
|
|
|
set => owner = value;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-25 08:19:33 -05:00
|
|
|
public SubmoduleBase(T owner)
|
|
|
|
|
{
|
|
|
|
|
this.owner = owner;
|
|
|
|
|
}
|
2026-02-13 09:22:11 -05:00
|
|
|
|
|
|
|
|
public void SetOwner(T newOwner)
|
|
|
|
|
{
|
|
|
|
|
this.owner = newOwner;
|
|
|
|
|
}
|
2025-11-25 08:19:33 -05:00
|
|
|
}
|
|
|
|
|
}
|