Пример #1
0
        public void Register(IAutoupdateableGameActor actor, int timePeriod = 1)
        {
            if (actor == null)
                throw new ArgumentNullException("actor");
            if (timePeriod <= 0)
                throw new ArgumentOutOfRangeException("timePeriod", "Update period has to be larger than zero.");
            Contract.EndContractBlock();

            m_register[timePeriod].Add(actor);
        }
Пример #2
0
        public void Register(IAutoupdateableGameActor actor, int timePeriod = 1)
        {
            if (actor == null)
            {
                throw new ArgumentNullException("actor");
            }
            if (timePeriod <= 0)
            {
                throw new ArgumentOutOfRangeException("timePeriod", "Update period has to be larger than zero.");
            }
            Contract.EndContractBlock();

            m_register[timePeriod].Add(actor);
        }
Пример #3
0
        private void InitAtlas(Map tmxDeserializedMap)
        {
            Action <GameActor> initializer = delegate(GameActor actor)
            {
                IAutoupdateableGameActor updateable = actor as IAutoupdateableGameActor;
                if (updateable != null && updateable.NextUpdateAfter > 0)
                {
                    AutoupdateRegister.Register(updateable, updateable.NextUpdateAfter);
                }
            };

            Atlas = MapLoader.LoadMap(tmxDeserializedMap, TilesetTable, initializer);

            Atlas.DayLength  = TWConfig.Instance.DayLengh;
            Atlas.YearLength = TWConfig.Instance.YearLength;

            IAtmosphere atmosphere = new SimpleAtmosphere(Atlas);

            Atlas.Atmosphere = atmosphere;
        }
Пример #4
0
 public void RegisterToAutoupdate(IAutoupdateableGameActor actor)
 {
     NewAutoupdateables.Add(actor);
 }