public void Consume(Feeder feeder, Consumable consumable, Interaction interaction) { foreach (Interactable i in subscribers) { if (i is Consumer) { ((Consumer)i).OnConsume(feeder.gameObject, consumable, interaction); } } feeder.Feed(); }
public override void OnBegin(GameObject interactor, Interaction interaction) { feeder = interactor.GetComponent <Feeder>(); if (feeder == null) { failed = true; return; } consumable = feeder.GetConsumable(); if (consumable == null || !consumableTypes.Contains(consumable.consumableType)) { failed = true; return; } // If we're holding an object, and there is already a job in progress, fail if (progression != null && !resetProgress) { failed = true; return; } foreach (Interactable i in subscribers) { if (i is Progressive) { ((Progressive)i).OnBegin(interactor, interaction); } } foreach (Interactable i in subscribers) { if (i is Consumer) { ((Consumer)i).OnConsume(interactor, consumable, interaction); } } feeder.Feed(); }