Game Development Reference
In-Depth Information
}
// Unsubscribe method for Inventory manager
public void UnSubscribeInventoryEvent(Action<InventoryItem>
subscriber)
{
if (inventorySubscribers != null)
{
inventorySubscribers.Remove(subscriber);
}
}
// Clear subscribers method for Inventory manager
public void ClearAllInventoryEventSubscribers()
{
if (inventorySubscribers != null)
{
inventorySubscribers.Clear();
}
}
With the message in place, we just need to broadcast this new message when the player
selects a button. We will add a new SelectButton method to the CommandBar script
to complete the journey, as follows:
public void Selectbutton(CommandButton button)
{
if (selectedButton != null)
{
selectedButton.ClearSelection();
}
selectedButton = button;
if (selectedButton != null)
{
MessagingManager.Instance.BroadcastInventoryEvent(selectedButton.Item);
}
else
{
Search WWH ::




Custom Search