void Select() { if (currentCharacter == null) { units[highlightedCharacter].Select(true); slots[highlightedCharacter].Select(true); descriptionMenu.SetCharacter(highlightedCharacter); characterMenu.SetCharacter(highlightedCharacter); } else { units[currentCharacter].Select(true); slots[currentCharacter].Select(true); descriptionMenu.SetCharacter(currentCharacter); characterMenu.SetCharacter(currentCharacter); selectedUnit = units[currentCharacter]; //fade out other units foreach (UnitSelection u in units.Values) { if (u == selectedUnit) { continue; } u.SetAlphaMoving(0f); u.SetLightMoving(0f); u.SetRaycast(false); } //move unit to center selectedUnit.SetPositionMoving(center.anchoredPosition); } descriptionMenu.gameObject.SetActive(true); }
void Deselect() { if (currentCharacter != null) { //fade in characters foreach (UnitSelection u in units.Values) { u.SetAlphaMoving(1.0f); u.SetLightMoving(0.5f); u.SetRaycast(true); } //move unit back to origin selectedUnit.SetPositionMoving(selectedUnit.Origin()); //set slots and unit ui units[currentCharacter].Select(false); slots[currentCharacter].Select(false); currentCharacter = null; } if (highlightedCharacter != null) { units[highlightedCharacter].Select(false); slots[highlightedCharacter].Select(false); highlightedCharacter = null; } descriptionMenu.gameObject.SetActive(false); }