private void Object_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (InventoryChanged != null) { InventoryChangedEventArgs eventArgs = new InventoryChangedEventArgs(this); InventoryChanged.Invoke(this, eventArgs); } }
private void ParkInventory_InventoryChanged(object sender, InventoryChangedEventArgs e) { // Update the list of things people desire, when the inventory gains a ride or shop desirables = new List <Desire>(); foreach (BuildableObject rideOrShop in ParkInventory.All) { if (!(rideOrShop is Shop) && !(rideOrShop is Ride)) { throw new ArgumentException("Not a ride or shop from inventory. Can't desire"); } desirables.Add(new Desire() { Object = (IDesirable)rideOrShop, Specific = null, // e.g: What drink, food or seat on a coaster? }); } GuestController.Desirables = desirables; }