public void DisableQueue() { disabled = true; foreach (Transform child in this.transform) { QueueCard tempCard = child.GetComponent <QueueCard>(); if (tempCard != null) { tempCard.returnButton.enabled = false; } } }
//Only the last item in the queue can be popped void TurnOnReturnButton() { int lastindex = this.transform.childCount - 1; for (int i = 0; i < this.transform.childCount; i++) { QueueCard tempCard = this.transform.GetChild(i).GetComponent <QueueCard>(); if (tempCard != null) { tempCard.returnButton.enabled = (i == lastindex); } } }
//check for if a card has been dropped into the queue void CheckForNewCards() { for (int i = 0; i < this.transform.childCount; i++) { Card tempCard = this.transform.GetChild(i).GetComponent <Card>(); if (tempCard != null && tempCard.APCost + CurrentAP <= MaxAP) { QueueCard NewQueue = Instantiate(tempCard.matchingQueueCard); NewQueue.transform.SetParent(this.transform); NewQueue.transform.SetAsLastSibling(); Destroy(tempCard.gameObject); this.transform.GetComponent <DropZone>().currentSize--; } } }