/// <summary> /// Loads and adds an object to the simulation. /// </summary> /// <param name="object">Object to add to simulation.</param> public void AddObject(SimulationObject @object) { @object.OnLoad(Editor); if (@object is Wall) { objects.Add(@object); } else { objects.Insert(0, @object); } if (@object is ISelectable selectable && selectable.Selectable) { SelectObject(selectable); } if (@object is IPersistent) { ObjectAdded?.Invoke(this, new EventArgs()); } // Cannon test if (@object is Cannon cannon) { cannon.Fired -= CannonFired; cannon.Fired += CannonFired; } }