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); }
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); }
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; }
public void RegisterToAutoupdate(IAutoupdateableGameActor actor) { NewAutoupdateables.Add(actor); }