public void Ready(int i_TeamIndex) { if (IsValidIndex(i_TeamIndex)) { if (!IsReady(i_TeamIndex)) { // Cancel current selection, if any. SelectionCache cache = m_SelectionsCache[i_TeamIndex]; if (!cache.IsEmpty()) { GameObject lastSelection = cache[0]; if (lastSelection != null) { tnUICharacterSlot slot = lastSelection.GetComponent <tnUICharacterSlot>(); if (slot != null) { slot.Deselect(); } } cache.Clear(); } m_Confirmations[i_TeamIndex] = true; UpdateOverlay(i_TeamIndex); SfxPlayer.PlayMain(m_ReadySfx); } } }
public void Confirm(int i_TeamIndex) { if (IsReady(i_TeamIndex)) { return; } if (IsValidIndex(i_TeamIndex)) { GameObject current = m_CurrentSlots[i_TeamIndex]; if (current != null) { SelectionCache cache = m_SelectionsCache[i_TeamIndex]; GameObject currentSelection = m_CurrentSlots[i_TeamIndex]; if (currentSelection != null) { if (cache.IsEmpty()) { cache.Add(currentSelection); tnUICharacterSlot slot = currentSelection.GetComponent <tnUICharacterSlot>(); if (slot != null) { slot.Select(); } } else { cache.Add(currentSelection); GameObject first = cache[0]; GameObject second = cache[1]; if (first == null || second == null) { return; } tnUICharacterSlot firstSlot = first.GetComponent <tnUICharacterSlot>(); tnUICharacterSlot secondSlot = second.GetComponent <tnUICharacterSlot>(); if (firstSlot == null || secondSlot == null) { return; } if (cache.Count == 2) { Swap(firstSlot, secondSlot); firstSlot.Deselect(); secondSlot.Deselect(); cache.Clear(); } } SfxPlayer.PlayMain(m_ConfirmSfx); } } } }