private void HandleSelectionBasedInputs() { if (Input.anyKeyDown) { if (Input.GetButtonDown("Stop")) { IssueStopCommand(SelectedEntities.Select(x => x.uniqueId).ToList()); } else if (Input.GetButtonDown("Retreat")) { IssueRetreatCommand(SelectedEntities.Select(x => x.uniqueId).ToList()); } else if (Input.GetButtonDown("Attack")) { SetTargeting(null, 0); foreach (Entity selectedEntity in SelectedEntities) { if (currentTargetingObject == null && selectedEntity.CanAttackLocations()) { SetTargeting(Instantiate <GameObject>(((LocationWeapon)selectedEntity.equippedWeapon).targetingPrefab), 0, null, selectedEntity); } } } else if (Input.GetButtonDown("CameraFocus")) { if (SelectedEntities.Count > 0) { if (SelectedEntities[0].Equals(LastFocusedEntity)) { LastFocusedEntity = SelectedEntities[0]; rtsCamera.SetFollowTarget(LastFocusedEntity.transform); } else { LastFocusedEntity = SelectedEntities[0]; rtsCamera.RefocusOn(LastFocusedEntity.transform.position); } } } else { Dictionary <string, List <Entity> > commandEntites = new Dictionary <string, List <Entity> >(); foreach (Entity selectedEntity in SelectedEntities) { string abilityTypeId = selectedEntity.GetAbilityTypeIdFromInput(); if (abilityTypeId != null) { if (!commandEntites.ContainsKey(abilityTypeId)) { commandEntites.Add(abilityTypeId, new List <Entity>()); } commandEntites[abilityTypeId].Add(selectedEntity); } } foreach (KeyValuePair <string, List <Entity> > commandEntity in commandEntites) { IssueAbilityCommand(commandEntity.Value.Select(x => x.uniqueId).ToList(), commandEntity.Key); } } } }