public void UpdateTargetPointer() { // @TODO: allow for multiple targets/AoE/Line/etc. if (currentCommandTarget == null) { List <BattleActor>[] targets = battleManager.GetAllTargets(); ISelectionItem command = commandStack.Peek().GetSelectedItem(); switch (((ChooseTargetSelectionItem)command).targetType) { case TargetType.Enemy: // @TODO: get last selected enemy, if possible currentCommandTarget = targets[0][0].gameObject; break; case TargetType.Ally: // @TODO: get last selected ally, if possible currentCommandTarget = targets[1][0].gameObject; break; case TargetType.Self: case TargetType.Free: Debug.LogWarning(command.GetSelectionType() + " not yet implemented"); return; } if (currentCommandTarget == null) { throw new System.Exception("Could not find a target"); } } pointer = battleHUD.SetPointerTarget(playerController, currentCommandTarget); }
public CommandPhase OnUpdate(LinkedListNode <UIActionType> input) { EventSelectionPanel currentUIPanel = null; if (commandData.commandStack.Count > 0) { currentUIPanel = commandData.commandStack.Peek(); } else { throw new System.Exception("Invalid CommandPhase State - " + "Currently in SelectingCommandPhase but there are no command panels"); } switch (input.Value) { case UIActionType.Down: currentUIPanel.NavigateDown(); break; case UIActionType.Up: currentUIPanel.NavigateUp(); break; case UIActionType.Right: currentUIPanel.NavigateRight(); break; case UIActionType.Left: currentUIPanel.NavigateLeft(); break; case UIActionType.CancelUICommand: currentUIPanel.Hide(); currentUIPanel.DestroyPanel(); commandData.commandStack.Pop(); if (commandData.commandStack.Count == 0) { return(CommandPhase.WaitingForInput); } break; case UIActionType.SubmitUICommand: ISelectionItem command = currentUIPanel.GetSelectedItem(); switch (command.GetSelectionType()) { case ISelectionType.ItemSelected: return(CommandPhase.SelectingTarget); case ISelectionType.OpenSubMenu: EventSelectionPanel esp = commandData.battleHUD.CreateSelectionPanel(); esp.SetOptionList(((SubMenuSelectionItem)command).subList, command.GetName()); commandData.commandStack.Push(esp); break; } break; } return(CommandPhase.SelectingCommand); }