private void itemReachedEnd(ItemTuple item, Node output)
        {
            foreach (AddRemoveItemInterface i in notifyInOutputReady)
            {
                bool toRemove = i.readyToRemoveItem(item.item);

                if (toRemove)
                {
                    this.items.Remove(item);
                    hasOutput = false;
                    return;
                }
            }

            if (output == null)
            {
                return;
            }

            if (output.inputFull())
            {
                return;
            }

            hasOutput = false;
            nodeTemplate.itemReachedEndProtocol(item);
            this.items.Remove(item);
            output.acceptItem(item);
            nextOutput = nodeTemplate.getOutputProtocol();
        }
        //--------------------------------------------------Utility Methods-------------------------------------------------------//

        private void addInput()
        {
            if (!canReceiveItem() || inputFull())
            {
                return;
            }

            Item item = null;

            foreach (AddRemoveItemInterface i in notifyInAcceptReady)
            {
                item = i.readyToAddItem();

                if (item != null)
                {
                    break;
                }
            }

            if (item == null)
            {
                return;
            }

            ItemTuple itemTuple = new ItemTuple(item);

            acceptItem(itemTuple);
        }
        public void acceptItem(ItemTuple item)
        {
            if (item == null)
            {
                return;
            }

            item.timeInCurrentNode        = item.timeInCurrentNode - item.timeToSpendInCurrentNode;
            item.timeToSpendInCurrentNode = 1 / nodeTemplate.getThroughput();
            this.items.Add(item);
            nodeTemplate.acceptItemProtocol(item);
        }
Esempio n. 4
0
        public override void processItem(ItemTuple item)
        {
            item.item.gameObject.transform.localPosition += new Vector3(0, speed * Time.deltaTime, 0);

            if (this.GetComponents <Node>().Length > 0)
            {
                targetTransform.GetComponent <Renderer>().materials[2].SetTextureOffset("_MainTex", new Vector3((speed / (laneFinalPosition - laneInitialPosition)) / this.GetComponents <Node>().Length *Time.time, 0, 0));
            }
            else
            {
                targetTransform.GetComponent <Renderer>().materials[2].SetTextureOffset("_MainTex", new Vector3((speed / (laneFinalPosition - laneInitialPosition)) * Time.time, 0, 0));
            }
        }
 public static ItemTuple clone(ItemTuple original)
 {
     return(new ItemTuple(original.item, original.timeInCurrentNode, original.timeToSpendInCurrentNode));
 }
Esempio n. 6
0
 public override void processItem(ItemTuple item)
 {
 }
Esempio n. 7
0
 public override void itemReachedEndProtocol(ItemTuple item)
 {
     item.item.gameObject = Instantiate(objectToInstantiate).gameObject;
 }
Esempio n. 8
0
 public override void acceptItemProtocol(ItemTuple item)
 {
     Destroy(item.item.gameObject);
     item.item.gameObject.transform.Rotate(new Vector3(90, 0, 0));
 }
Esempio n. 9
0
 public override void itemReachedEndProtocol(ItemTuple item)
 {
 }
Esempio n. 10
0
 public override void acceptItemProtocol(ItemTuple item)
 {
     item.item.gameObject.transform.SetParent(transform);
     item.item.gameObject.transform.rotation      = Quaternion.identity;
     item.item.gameObject.transform.localPosition = itemInitialPosition;
 }
 public abstract void acceptItemProtocol(ItemTuple item);     //called when item enters node
 public abstract void itemReachedEndProtocol(ItemTuple item); //called when item needs to be pushed to next node
 public abstract void processItem(ItemTuple item);            //specify here what u want the item to do while in the node
 public abstract void acceptItemProtocol(ItemTuple item);     //called when item enters node
 public abstract void start();                                //the beggining of the next opperation
 public abstract void processItem(ItemTuple item);            //specify here what u want the item to do while in the node