Example #1
0
        public void RecycleObject(int iResid, GameObject obj)
        {
            if (m_ObjectPool.ContainsKey(iResid))
            {
                GameObjectPool objpool = (GameObjectPool)m_ObjectPool[iResid];
                obj.transform.position = Vector3.zero;

                objpool.RecyclePrefabInstance(obj);
            }
            else//暂时处理,后面重构代码
            {
                Object.Destroy(obj);
            }
        }
Example #2
0
        void Update()
        {
            if (null != CoreEntry.gCameraMgr.MainCamera)
            {
                mEndPos = CoreEntry.gCameraMgr.MainCamera.transform.position + (mRay.direction).normalized * mDistance;
            }
            Vector3 dir = mEndPos - transform.position;
            float   dis = dir.magnitude;

            if (dis > 0.1f)
            {
                transform.position = Vector3.Lerp(transform.position, mEndPos, Time.deltaTime * mTimeParam);
                mTimeParam        += 0.05f;
            }
            else
            {
                if (null != mPickObjectPool)
                {
                    mPickObjectPool.RecyclePrefabInstance(gameObject);
                }
            }
        }
Example #3
0
        /// <summary>
        /// 回收掉落物品
        /// </summary>
        /// <param name="unusedDropItem"></param>
        private void ReleaseDropItem(DropItemInfo unusedDropItem)
        {
            EventToUI.SetArg(UIEventArg.Arg1, unusedDropItem.dropItemObj);
            EventToUI.SendEvent("EU_REMOVE_DROPITEMTEXT");

            GameObjectPool objPool = m_moneyEftObjectPool;

            if (unusedDropItem.dropType == DROP_TYPE.DROPTYPE_COMMON)
            {
                objPool = m_itemEftPoolDict[unusedDropItem.dropEft];
            }

            if (null != unusedDropItem.dropQualityEftObj)
            {
                CoreEntry.gGameObjPoolMgr.Destroy(unusedDropItem.dropQualityEftObj);
            }

            if (unusedDropItem.dropItemObj != null)
            {
                objPool.RecyclePrefabInstance(unusedDropItem.dropItemObj);
                unusedDropItem.dropItemObj = null;
            }
            m_UnusedDropItemList.Add(unusedDropItem);
        }