private void ShowAllMoveButtons() { foreach (Transform child in transform.parent) { MovePeople movePeople = child.GetComponent <MovePeople>(); bool active = movePeople.people.AnyAlive(); movePeople.button.gameObject.SetActive(active); } }
private void HideAllMoveButtonsExceptAdjacent() { for (int i = 0; i < transform.parent.childCount; i++) { bool adjacent = Mathf.Abs(transform.GetSiblingIndex() - i) <= 1; MovePeople people = transform.parent.GetChild(i).GetComponent <MovePeople>(); people.button.gameObject.SetActive(adjacent); } }
private void Deselect() { selected = null; buttonImage.color = baseButtonColor; ShowAllMoveButtons(); }
private void Select() { selected = this; buttonImage.color = buttonSelectedColor; HideAllMoveButtonsExceptAdjacent(); }