Ejemplo n.º 1
0
 /// <summary>
 /// 重置游戏对象
 /// </summary>
 public virtual void ResetActionData()
 {
     _gameObject = null;
     _transform  = null;
     if (_particleSystem != null)
     {
         _particleSystem.Stop(true);
         _particleSystem = null;
     }
     if (_animationList != null)
     {
         foreach (Animation animation in _animationList)
         {
             animation.Stop();
         }
         _animationList = null;
     }
     _particleSystemList = null;
     _particleRendererList.Clear();
     _animationStateList = null;
     if (_actionData != null)
     {
         Action3DManager.inst.ReleaseActionData(_actionData);
         _actionData = null;
     }
 }
Ejemplo n.º 2
0
        public void Release(ActionData3D actionData)
        {
            actionData.gameObject.SetActive(false);
            Transform transform = actionData.gameObject.transform;

            transform.SetParent(null, false);
            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.Euler(0, 0, 0);
            actionDatas.Enqueue(actionData);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 释放游戏对象
        /// </summary>
        /// <param name="actionData"></param>
        public void ReleaseActionData(ActionData3D actionData)
        {
            ActionDataPackage3D cache = GetCache(actionData.package.packageName, actionData.package.name);

            if (cache == null)
            {
                return;
            }

            cache.Release(actionData);
            cache.Unuse();
        }
Ejemplo n.º 4
0
        public ActionData3D Get()
        {
            if (actionDatas.Count > 0)
            {
                ActionData3D actionData = actionDatas.Dequeue();
                actionData.gameObject.SetActive(true);

                return(actionData);
            }
            else if (prefab != null)
            {
                ActionData3D actionData = App.objectPoolManager.GetObject <ActionData3D>();
                GameObject   gameObject = UnityEngine.Object.Instantiate(prefab) as GameObject;
                actionData.package    = this;
                actionData.gameObject = gameObject;

                return(actionData);
            }
            return(null);
        }