/** * Register the object toNotify to be called when the gameObject is ready to output an item (method called is readyToRemoveItem()). * To use this method implement the AddRemoveItemInterface on the object that wants to call this method. * The GameObject must be part of the item transportation network item so they must have a Node and NodeTemplate script. */ public static void callWhenReadyToRemoveItem(GameObject gameObject, AddRemoveItemInterface toNotify) { if (gameObject.GetComponent <Node>() == null) { throw new ItemTransportationException("Missing Node component in gameObject" + gameObject.GetInstanceID()); } if (gameObject.GetComponent <NodeTemplate>() == null) { throw new ItemTransportationException("Missing NodeTemplate component in gameObject" + gameObject.GetInstanceID()); } gameObject.GetComponents <Node>()[gameObject.GetComponents <Node>().Length - 1].addToNotifyOnOutputReady(toNotify); }
public void addToNotifyOnOutputReady(AddRemoveItemInterface toNotify) { this.notifyInOutputReady.Add(toNotify); }