/// <summary> /// Deselects an unit, removing the <see cref="SelectedUnit"/> component and turning it back to its default state /// </summary> private void deselectUnit() { if (SelectedUnit != null) { var selectedUnitComponent = SelectedUnit.GetComponent <SelectedUnit>(); selectedUnitComponent.Deselect(); Destroy(selectedUnitComponent); MatchManager.DeactivateUIForUnit(SelectedUnit); SelectedUnit = null; } }
/// <summary> /// Applies an already validated decision /// </summary> /// <param name="decision">An already validated decision</param> /// <returns></returns> private IEnumerator applyDecision(Decision decision) { if (decision.Type != DecisionType.EndTurn && currentPlayer.FactionManager.IsHuman) { m_matchManager.DeactivateUIForUnit(decision.SourceUnit); } if (decision.Type == DecisionType.Move) { yield return(applyMove(decision)); } if (decision.Type == DecisionType.Attack) { yield return(applyAttack(decision)); } if (decision.Type != DecisionType.EndTurn && currentPlayer.FactionManager.IsHuman) { m_matchManager.ActivateUIForUnit(decision.SourceUnit); } }