The Task Launcher component handles creating and managing tasks for both units and buildings.
Attach this component to a unit or a building in order to add tasks that can launched when the unit/building is selected.
General view of the Task Launcher Component.
Task Launcher Settings:
Task Launcher Code: Unique code for the task launcher to be recognized by custom events.
Min Health: Minimum health value that the task holder (either the unit or the building) must have in order to launch a task from this task launcher.
Max Active Tasks: The maximum amount of the tasks that the task launcher can have on the queue to be launched.
Launch Task Sound Effect: Audio clip played when a task is successfully launched.
Declined Task Sound Effect: Audio clip played when a task can not be launched for any reason (insufficient resources, etc..).
To add a task, you can simply click the button “Add Task” which also displays the current task count. To navigate between tasks, you can use both the “<<” (go to previous task) or the “>>” (go to next task) buttons. The task ID that you are currently configuring will be displayed between the navigation buttons and the toolbar. Right after the task settings, a “Remove Task” button will delete the displayed task when clicked.
General Task Settings:
The first tab on the toolbar provides a list of general settings that applied to all task types.
- Task Code: Unique code for this task to be recognized by custom events.
- Available by Default: Is this task available to launch by default or not? If this task should be only available once another task is completed, then disable this.
- Faction Specific: If the task is faction type specific (only one type of faction can actually start this), then enable this.
- Faction Code: If the task is faction type specific, then this field will appear at which you’ll be able set the code of the faction that can launch this task.
- Unit Creation: produce units.
- Destroy: task holder self-destruction.
- Custom Task: will only call custom events.
- Building Upgrade: upgrade a building.
- Unit Upgrade: upgrade a unit.
- Description: A short description for the task that will appear when the player’s mouse is over the task icon.
- Task Panel Category: When using categories in the task panel (check the UI Manager documentation), this is the ID of the task panel that this task belongs to when it appears while selecting this task launcher’s holder and displaying its tasks. Task Panel categories allow to organize tasks based on a criteria that you can decide.
- Icon: The icon that will appear in the task panel for this task.
- Reload Time: Duration before this task takes effect.
- Required Resources: Which resources and how much of these resources does the task need to be launched? Amount of resource types matches the size of the array in this field. For each element of this array, provide the name of the resource and the amount required.
- One-Time Use: Enable this if you only want the player to launch this task once (and after using it once, it will get removed and player will not be able to launch it again). Once this is enabled, a toggle field called “Use once on all instances” which, when enabled, disables the task in all instances of the task launcher (where the task is) once completed.
- Tasks To Unlock: An array of task codes that get enabled once this task is completed. This can be used for upgrade tasks that are only available once a previous upgrade task is completed.
- Task Completed Audio: Audio clip played when the task is done.
Custom Task Settings:
The second tab of the toolbar provides a list of settings that are specific to the task type that has been chosen in the general task settings tab.
- Unit Creation Task:
- Prefabs: A list of the unit prefabs that can be created using this task. You can more than one prefab for a unit creation task and only one will be randomly chosen each time to be created. If you only want to create one unit type using this task then you can simply assign only one unit prefab into this field.
- Unit Upgrade/Building Upgrade:
- Other Task Types: There are no custom settings for the rest of the task types.
In addition to the delegate events (which are called for tasks). You can trigger events for each task independently by using the event triggers below:
- Task Launch Event: Triggered when the task is launched.
- Task Complete Event: Triggered when the task is completed.
- Task Cancel Event: Triggered when the task is cancelled.