public void Register(IAutoupdateable 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);
        }
Esempio n. 2
0
        private void InitAtlas(Map tmxDeserializedMap)
        {
            Action <GameActor> initializer = delegate(GameActor actor)
            {
                IAutoupdateable updateable = actor as IAutoupdateable;
                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;
        }
Esempio n. 3
0
 public void RegisterToAutoupdate(IAutoupdateable actor)
 {
     NewAutoupdateables.Add(actor);
 }