示例#1
0
        /// <summary>
        /// process to next subpulse
        /// </summary>
        /// <param name="currentDateTime"></param>
        /// <param name="maxSpan">maximum time delta</param>
        /// <returns>datetime processed to</returns>
        private void ProcessToNextInterupt(DateTime nextInteruptDateTime)
        {
            if (EntityDictionary.ContainsKey(nextInteruptDateTime))
            {
                foreach (KeyValuePair <PulseActionEnum, List <Entity> > delegateListPair in EntityDictionary[nextInteruptDateTime])
                {
                    if (delegateListPair.Value.Count == 0)// == null) //if the list is empty, it's a systemwide interupt
                    {
                        //delegateListPair.Key.DynamicInvoke(_starSystem);
                        PulseActionDictionary.DoAction(delegateListPair.Key, _entityManager);
                    }
                    else
                    {
                        foreach (Entity entity in delegateListPair.Value) //foreach entity in the value list
                        {
                            //delegateListPair.Key.DynamicInvoke(entity);
                            PulseActionDictionary.DoAction(delegateListPair.Key, _entityManager, entity);
                        }
                    }
                }

                EntityDictionary.Remove(nextInteruptDateTime);
            }

            SystemLocalDateTime = nextInteruptDateTime; //update the localDateTime and invoke the SystemDateChangedEvent
        }
示例#2
0
        private DateTime ProcessNextInterupt(DateTime maxDateTime)
        {
            DateTime processedTo;
            DateTime nextInteruptDateTime;

            if (EntityDictionary.Keys.Count != 0)
            {
                nextInteruptDateTime = EntityDictionary.Keys.Min();
                if (nextInteruptDateTime <= maxDateTime)
                {
                    foreach (var delegateListPair in EntityDictionary[nextInteruptDateTime])
                    {
                        foreach (var jumpPair in delegateListPair.Value) //foreach entity in the value list
                        {
                            //delegateListPair.Key.DynamicInvoke(_game, jumpPair);
                            PulseActionDictionary.DoAction(delegateListPair.Key, _game, jumpPair);
                        }
                    }
                    processedTo = nextInteruptDateTime;
                }
                else
                {
                    processedTo = maxDateTime;
                }
            }
            else
            {
                processedTo = maxDateTime;
            }

            return(processedTo);
        }