public Game(IDrawer drawer, uint width, uint height) { curRect.Width = width; curRect.Height = height; Intervals = Observable.Interval(TimeSpan.FromMilliseconds(TimeStep)); _unityContainer = new UnityContainer(); this.RegisterInUnityContainer(); StateQueueManager = _unityContainer.Resolve<StateQueueManager>(); Map = _unityContainer.Resolve<Map>(); loadSaveManager = new LoadSaveManager(); loadSaveManager.LoadSnapshot(Map); _hero = _unityContainer.Resolve<Hero>(); _hero.Map = Map; ActionRepository = _unityContainer.Resolve<IActionRepository>(); _drawer = drawer; Intervals.Subscribe(StateQueueManager); _dayNightCycle = new DayNightCycle(); Intervals.Subscribe(_dayNightCycle); }
public Game(IDrawer drawer, uint width, uint height) { curRect.Width = width; curRect.Height = height; Intervals = Observable.Interval(TimeSpan.FromMilliseconds(TimeStep)) .Where(t => !_isPaused); _unityContainer = new UnityContainer(); RegisterInUnityContainer(); StateQueueManager = _unityContainer.Resolve <StateQueueManager>(); PlannedQueueManager = _unityContainer.Resolve <PlannedQueueManager>(); Map = _unityContainer.Resolve <Map>(); Factory = _unityContainer.Resolve <ObjectsFactory>(); loadSaveManager = new LoadSaveManager(); loadSaveManager.LoadSnapshot(Map); _hero = _unityContainer.Resolve <Hero>(); _hero.Map = Map; ActionRepository = _unityContainer.Resolve <IActionRepository>(); _drawer = drawer; Intervals.Subscribe(StateQueueManager); Intervals.Subscribe(PlannedQueueManager); _dayNightCycle = _unityContainer.Resolve <DayNightCycle>(); Intervals.Subscribe(_dayNightCycle); var heroLifeCycle = _unityContainer.Resolve <HeroLifeCycle>(); Intervals.Subscribe(heroLifeCycle); }