public void Start() { this.Load(); foreach (Component <World> component in this.GetComponents()) { IUpdate update = component as IUpdate; if (update != null) { this.iUpdates.Add(update); } IStart start = component as IStart; if (start != null) { start.Start(); } } // loop while (!this.isStop) { Thread.Sleep(1); foreach (IUpdate update in this.iUpdates) { update.Update(); } } }
private void Start() { unique.Clear(); while (this.starts.Count > 0) { Disposer disposer = this.starts.Dequeue(); if (!this.unique.Add(disposer)) { continue; } if (!this.disposerEvents.TryGetValue(disposer.GetType(), out IObjectSystem objectEvent)) { continue; } IStart iStart = objectEvent as IStart; if (iStart == null) { continue; } objectEvent.Set(disposer); iStart.Start(); } }
private void Start() { starts = newStarts; newStarts = new List <long>(); foreach (long id in starts) { Object obj; if (!this.objects.TryGetValue(id, out obj)) { continue; } IObjectEvent objectEvent; if (!objectEvents.TryGetValue(obj.GetType(), out objectEvent)) { continue; } IStart iStart = objectEvent as IStart; if (iStart == null) { continue; } objectEvent.SetValue(obj); iStart.Start(); } }
private void Start() { while (this.starts.Count > 0) { Disposer disposer = this.starts.Dequeue(); IObjectEvent objectEvent; if (!this.disposerEvents.TryGetValue(disposer.GetType(), out objectEvent)) { continue; } IStart iStart = objectEvent as IStart; if (iStart == null) { continue; } objectEvent.Set(disposer); iStart.Start(); } }