/// <summary> /// Unit selected event behaviour. /// </summary> /// <remarks> /// Selects unit for attack and triggers attack if four units selected. /// Return selected state if same player unit selected. /// </remarks> /// <param name="unit">Unit being selected.</param> /// <returns>New state of single player turn state machine.</returns> public override TurnState UnitSelected(Unit enemy) { if (helicopter.CanUseSpecial()) { if (enemy.PlayerOwner != player.Index) { enemy.SelectAsTargetForHelicopterSpecial(); unitsToAttack.Add(enemy); if (unitsToAttack.Count == 4) { DeselectAllInList(); helicopter.UseSpecial(unitsToAttack); return(new SelectedState(ui, player, unit)); } return(this); } DeselectAllInList(); return(new SelectedState(ui, player, enemy)); } return(this); }