Class TaskSystem
Core system to handle in-game task that interrupt the gameplay
Methods
AddToFirst(int, object)
Add a new task to first in current queue with custom data
Declaration
public static Task AddToFirst(int id, object userData = null)
Parameters
Type | Name | Description |
---|---|---|
int | id | Type ID of the task. Use typeof(YourTask).AngeHash() to cache this ID |
object | userData | Custom data of this operation. Use Task.UserData to get this data in the task's internal logic. |
Returns
Type | Description |
---|---|
Task | True if successfuly added |
AddToLast(int, object)
Add a new task to last in current queue with custom data
Declaration
public static Task AddToLast(int id, object userData = null)
Parameters
Type | Name | Description |
---|---|---|
int | id | Type ID of the task. Use typeof(YourTask).AngeHash() to cache this ID |
object | userData | Custom data of this operation. Use Task.UserData to get this data in the task's internal logic. |
Returns
Type | Description |
---|---|
Task | True if successfuly added |
ClearAllTask()
Reset all current performing tasks
Declaration
public static void ClearAllTask()
EndAllTask()
Make all current performing task ends
Declaration
public static void EndAllTask()
GetCurrentTask()
Get instance of current performing task
Declaration
public static Task GetCurrentTask()
GetTaskAt(int)
Get instance of task inside current performing queue
Declaration
public static Task GetTaskAt(int index)
GetWaitingTaskCount()
Get how many tasks are currently waiting for the current task
Declaration
public static int GetWaitingTaskCount()
HasTask()
True if there are any task performing
Declaration
public static bool HasTask()
HasTask<T>()
True if there are any task in given type performing
Declaration
public static bool HasTask<T>() where T : Task
PeekFromPool(int)
Get global single instance of the task for given type ID
Declaration
public static Task PeekFromPool(int id)
TryAddToFirst(int, out Task)
Add a new task to first in current queue
Declaration
public static bool TryAddToFirst(int id, out Task task)
Parameters
Type | Name | Description |
---|---|---|
int | id | Type ID of the task. Use typeof(YourTask).AngeHash() to cache this ID |
Task | task | Instance of the task |
Returns
Type | Description |
---|---|
bool | True if successfuly added |
TryAddToFirst(int, object, out Task)
Add a new task to first in current queue with custom data
Declaration
public static bool TryAddToFirst(int id, object userData, out Task task)
Parameters
Type | Name | Description |
---|---|---|
int | id | Type ID of the task. Use typeof(YourTask).AngeHash() to cache this ID |
object | userData | Custom data of this operation. Use Task.UserData to get this data in the task's internal logic. |
Task | task | Instance of the task |
Returns
Type | Description |
---|---|
bool | True if successfuly added |
TryAddToLast(int, out Task)
Add a new task to last in current queue
Declaration
public static bool TryAddToLast(int id, out Task task)
Parameters
Type | Name | Description |
---|---|---|
int | id | Type ID of the task. Use typeof(YourTask).AngeHash() to cache this ID |
Task | task | Instance of the task |
Returns
Type | Description |
---|---|
bool | True if successfuly added |
TryAddToLast(int, object, out Task)
Add a new task to last in current queue with custom data
Declaration
public static bool TryAddToLast(int id, object userData, out Task task)
Parameters
Type | Name | Description |
---|---|---|
int | id | Type ID of the task. Use typeof(YourTask).AngeHash() to cache this ID |
object | userData | Custom data of this operation. Use Task.UserData to get this data in the task's internal logic. |
Task | task | Instance of the task |
Returns
Type | Description |
---|---|
bool | True if successfuly added |