public void Reset()
        {
            this.oldestTick         = Tick.Invalid;
            this.lastSavedStateTick = Tick.Invalid;

            this.syncHash.Clear();
            this.statesHistory.DiscardAll();
            this.statesHistory.Clear();

            foreach (var item in this.events)
            {
                PoolSortedList <long, HistoryEvent> .Recycle(item.Value);
            }
            this.events.Clear();
        }
Example #2
0
        void IModuleBase.OnDeconstruct()
        {
            //this.maxTick = Tick.Zero;
            this.prewarmed = false;
            //this.beginAddEventsTick = Tick.Zero;
            this.beginAddEventsCount      = 0;
            this.beginAddEvents           = false;
            this.statEventsAdded          = 0;
            this.statPlayedEvents         = 0;
            this.oldestTick               = Tick.Invalid;
            this.lastSavedStateTick       = Tick.Invalid;
            this.pauseStoreStateSinceTick = Tick.Invalid;

            this.statesHistory.DiscardAll();

            this.world.SetStatesHistoryModule(null);

            foreach (var item in this.events)
            {
                var values = item.Value.Values;
                for (int i = 0, cnt = values.Count; i < cnt; ++i)
                {
                    var val = values[i];
                    if (val.parameters != null)
                    {
                        PoolArray <object> .Recycle(ref val.parameters);
                    }
                }
                item.Value.Clear();
                PoolSortedList <long, HistoryEvent> .Recycle(item.Value);
            }
            PoolDictionary <Tick, ME.ECS.Collections.SortedList <long, HistoryEvent> > .Recycle(ref this.events);

            foreach (var kv in this.syncHashTable)
            {
                PoolDictionary <int, int> .Recycle(kv.Value);
            }
            PoolDictionary <Tick, Dictionary <int, int> > .Recycle(ref this.syncHashTable);

            //this.states.Recycle();
            //this.states = null;
        }