123456789101112131415161718192021222324252627282930313233 |
- using System;
- namespace XGame.Framework.Nodes
- {
- /// <summary>
- /// node的逻辑组件基类
- /// </summary>
- public abstract class NodeComponent : INodeComponent, IDisposable
- {
- private NodeContext _context;
- public NodeContext Context => _context;
- /// <summary>
- /// node节点的忽略order
- /// </summary>
- public int Order => 0;
- public void Bind(object context)
- {
- _context = context as NodeContext;
- }
- void IDisposable.Dispose()
- {
- OnDispose();
- _context = default;
- }
- public abstract void OnEnable(object intent);
- public abstract void OnDisable();
- protected virtual void OnDispose()
- {
- }
- }
- }
|