using System;
using UnityEngine;
using XGame.Framework.ObjectCollection;

namespace XGame.Framework.Map
{
    public abstract class EntityViewModel : IEntityViewModel, IDisposable
    {
        private EntityBehaviour _behaviour;
        public Transform Tr => _behaviour.transform;
        public void Init(EntityBehaviour behaviour)
        {
            _behaviour = behaviour;
            OnInit(behaviour.Collector);
        }
        void IDisposable.Dispose()
        {
            OnDispose();
            _behaviour = null;
        }
        protected abstract void OnInit(IObjectCollector collector);
        protected virtual void OnDispose()
        {
        }


    }
}