private void InternalDetachGameObject() { OnDetachGameObject(); GameObjectEx.Uninit(); PoolMgr.singleton.ReleaseCsharpObject(GameObjectEx); GameObjectEx = null; }
private void InternalAttachGameObject(GameObjectEx go) { GameObjectEx = go; Animator = GameObjectEx.gameObject.GetComponent <Animator>(); UnityObject.DontDestroyOnLoad(GameObjectEx.gameObject); OnAttachGameObject(go); }
/// <summary> /// Entity附加GameObject; /// </summary> /// <param name="go"></param> protected virtual void OnAttachGoEx(GameObjectEx go) { gameObjectEx = go; if (_entityLoadFinishHandler != null) { _entityLoadFinishHandler(this, gameObjectEx.gameObject); } }
/// <summary> /// 初始化Entity; /// </summary> /// <param name="entityId"></param> /// <param name="uid"></param> /// <param name="name"></param> public void Initialize(int entityId, ulong uid, string name) { UID = uid; EntityName = name; EntityId = entityId; Enable = true; GameObjectEx = PoolMgr.singleton.GetCsharpObject <GameObjectEx>(); InternalInitialize(); GameObjectEx.AddLoadFinishHandler((goex) => { InternalAttachGameObject(goex); _entityLoadFinishHandler?.Invoke(this, GameObjectEx.gameObject); }); GameObjectEx.Init(this, AssetPath); }
protected override void OnAttachGameObject(GameObjectEx goEx) { base.OnAttachGameObject(goEx); _stateMachine = StateMachineMgr.singleton.CreateStateMachine(Entity); }
/// <summary> /// Component附加GameObject; /// </summary> /// <param name="go"></param> protected virtual void OnAttachGoEx(GameObjectEx goEx) { }
private void InternalAttachGameObject(GameObjectEx go) { GameObjectEx = go; Animator = GameObjectEx.gameObject.GetComponent <Animator>(); OnAttachGameObject(go); }
/// <summary> /// Entity附加GameObject; /// </summary> /// <param name="go"></param> protected virtual void OnAttachGameObject(GameObjectEx go) { }