private void showHighlights() { setHighlighted(true); sister.setHighlighted(true); if (action.Target != null) { Tooltippable correspondingHighlightable = action.Target.GetComponent <Tooltippable>(); correspondingHighlightable.setHighlighted(true); correspondingHighlightable.showTargetInfoText(action.getAdditionalTextForTarget(action.Target)); } }
public void selectAction(Action selected) { inSelectionState = true; isFirstFrameAfterSelected = true; this.selected = selected; //if the action is targeted, ask for targets if (selected.IsTargeting) { List <Targetable> possibleTargets = selected.getPossibleTargets(); possibleTargets.ForEach((x) => { //highlight the possible targets Tooltippable guiObj = x.GetComponent <Tooltippable>(); guiObj.setHighlighted(true); guiObj.showTargetInfoText(selected.getAdditionalTextForTarget(x)); clickHandlers[x] = new EventHandlers(); //attach click event handlers to the possible targets so they're selected when they're clicked System.Action clickAction = () => scheduleAction(x); clickHandlers[x].click = clickAction; guiObj.OnClicked += clickAction; //attach hover event handlers to possible targets so that they display edge visibility data when hovered over System.Action hoverAction = () => startHoverForTarget(x); clickHandlers[x].hover = hoverAction; guiObj.OnHover += hoverAction; System.Action endHoverAction = () => endHoverForTarget(x); clickHandlers[x].endHover = endHoverAction; guiObj.OnEndHover += endHoverAction; }); return; } //no target needed //add the action to the player scheduleAction(null); }