예제 #1
0
        private void OnUnitAddedToQueue(UnitInfo unitInfo)
        {
            this.Log("Adding to queue");
            QueueIcon newUnit = Instantiate(this.buttonPrefab, Vector3.zero, Quaternion.identity, this.transform);

            newUnit.Setup(unitInfo, () => RemoveUnitFromQueue(newUnit));
            // Add the unit to the queue visually
            this.unitQueue.AddLast(newUnit);
        }
예제 #2
0
        private void RemoveUnitFromQueue(QueueIcon iconToRemove)
        {
            int i;
            LinkedListNode <QueueIcon> node = this.unitQueue.First;

            for (i = 0; node != null && node.Value != iconToRemove; i++)
            {
                node = node.Next;
            }

            if (node != null)
            {
                Destroy(node.Value.gameObject);
                this.unitQueue.Remove(node);
                GameEvents.OnUnitRemovedFromQueue.Invoke(i);
            }
        }