using System;
using XGame.Framework.Components;

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;
        void IComponent.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()
        {
        }
    }
}
