private void CheckBindings(ISimStatsType stats, ISimConfigType config) { if (stats == null) { throw new NullReferenceException(nameof(ISimStatsType)); } if (config == null) { throw new NullReferenceException(nameof(ISimConfigType)); } }
public void Bind(ISimStatsType stats, ISimConfigType config) { if (_binded) { return; } CheckBindings(stats, config); config.Config.OnChanged += cfg => _simAreaSize = new Vector2(cfg.gameAreaWidth, cfg.gameAreaHeight); stats.State.OnChanged += SetupOnState; _binded = true; }
public void Bind(ISimStatsType stats, ISimConfigType config) { if (_binded) { return; } CheckBindings(stats, config); config.Config.OnChanged += cfg => _config = cfg; stats.State.OnChanged += OnPublicStateChanged; ViewState.OnChanged += OnViewStateChanged; _publicState = stats.State; _binded = true; }