/// <summary> /// 初始化Component; /// </summary> /// <param name="entity">entity</param> /// <param name="go">gameObject</param> public void Initialize(ObjectEx owner) { Enable = true; InternalAttachObject(owner); if (Entity != null) { if (Entity.GameObject != null && Entity.GameObject.gameObject != null) { OnAttachGameObject(Entity.GameObject); } else { Entity.LoadFinishEventHandler += (entity) => { OnAttachGameObject(entity.GameObject); }; } } EventSubscribe(); InitializeEx(); }
private void InternalAttachObject(ObjectEx owner) { Owner = owner; Entity = owner as AbsEntity; OnAttachObject(owner); }
/// <summary> /// Component附加Entity; /// </summary> /// <param name="entity"></param> protected virtual void OnAttachObject(ObjectEx owner) { }