Пример #1
0
        public TicksUpdater(int tickTime, float fixedUpdateTime = 0.3f)
        {
            FixedUpdateTime       = fixedUpdateTime;
            mFixedUpdateDeltaTime = (int)(fixedUpdateTime * 1000);
            mFixedUpdateCountTime = mFixedUpdateDeltaTime;
            if (mThreadTicks == null)
            {
                mThreadTicks = new ThreadTicks(tickTime);
                mThreadTicks.Add(Updating);
                mThreadTicks.Start();
            }
            mTicksLater  = new TicksLater();
            mTicksList   = new List <IUpdate>();
            mListDeleted = new List <IUpdate>();

            Enabled();
        }
Пример #2
0
        public void Dispose()
        {
            mIsDisposed = true;
            ShipDockConsts.NOTICE_REMOVE_UPDATE.Remove(RemoveUpdate);
            ShipDockConsts.NOTICE_ADD_UPDATE.Remove(AddUpdate);

            Utils.Reclaim(ref mTicksList);
            Utils.Reclaim(ref mListDeleted);
            Utils.Reclaim(mTicksLater);
            Utils.Reclaim(mThreadTicks);

            mItem          = null;
            mItemAdded     = null;
            mItemRemoved   = null;
            mNoticeAdded   = null;
            mNoticeRemoved = null;
            mTicksLater    = null;
            mThreadTicks   = null;
        }