//called each time a player owned resource generator is either full or collected private void OnResourceGeneratorUpdated(ResourceGenerator resourceGenerator, int generatorID) { if (SelectionManager.IsSelected(resourceGenerator.building.GetSelection(), true, true)) //if the resource generator's building is the only selected entity { gameMgr.UIMgr.HideTooltip(); //hide the tooltip in case resource have been collected and the task is gone Update(); } }
//called each time a faction entity switches its attack: private void OnAttackSwitch(AttackEntity attackEntity, FactionEntity target, Vector3 targetPosition) { //only if the source faction entity is the only player entity selected if (SelectionManager.IsSelected(attackEntity.FactionEntity.GetSelection(), true, true)) { Update(); } }
//called each time a unit is added/removed to/from an APC private void OnAPCUpdated(APC apc, Unit unit) { //show APC tasks only if the apc is the only entity selected if (SelectionManager.IsSelected(apc.FactionEntity.GetSelection(), true, true)) { Update(); } }
//called each time a unit wandering behavior is toggled private void OnUnitWanderToggled(Unit unit) { //show wander tasks only if this one unit is selected if (SelectionManager.IsSelected(unit.GetSelection(), true, true)) { Update(); } }
//called each time a task launcher status is updated (task added, cancelled or completed) private void OnTaskLauncherStatusUpdated(TaskLauncher taskLauncher, int taskID, int taskQueueID) { //only show the task launcher tasks if the task launcher is the only player entity selected if (SelectionManager.IsSelected(taskLauncher.FactionEntity.GetSelection(), true, true)) { Update(); if (taskLauncher.GetTask(taskID).IsAvailable == false) //if the task is no longer available { gameMgr.UIMgr.HideTooltip(); //hide the tooltip } } }