From b80bdaf6f7e05685a473b0524256ed406c07285f Mon Sep 17 00:00:00 2001 From: Lena Linke <130255332+lenalinke@users.noreply.github.com> Date: Sat, 27 Apr 2024 23:30:15 +0200 Subject: [PATCH] Remove coroutineHost from TaskBundle --- .../ScheduleBasedExecution/TaskBundle.cs | 18 ++++-------------- .../TaskBundle Sample/TaskBundleController.cs | 4 ++-- Documentation/manual/task-bundle.md | 7 +++---- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Assets/Virtual Agents Framework/Runtime/Scripts/ScheduleBasedExecution/TaskBundle.cs b/Assets/Virtual Agents Framework/Runtime/Scripts/ScheduleBasedExecution/TaskBundle.cs index 04fcad7..cd9411e 100644 --- a/Assets/Virtual Agents Framework/Runtime/Scripts/ScheduleBasedExecution/TaskBundle.cs +++ b/Assets/Virtual Agents Framework/Runtime/Scripts/ScheduleBasedExecution/TaskBundle.cs @@ -12,28 +12,23 @@ namespace i5.VirtualAgents /// public class TaskBundle : AgentBaseTask { - // The coroutine host which is used to start coroutines as TaskBundles are no MonoBehaviours - private MonoBehaviour coroutineHost; - public TaskBundle(MonoBehaviour coroutineHost) + public TaskBundle() { this.State = TaskState.Waiting; TaskQueue = new List(); - this.coroutineHost = coroutineHost; } - public TaskBundle(MonoBehaviour coroutineHost, List tasks) + public TaskBundle(List tasks) { this.State = TaskState.Waiting; TaskQueue = tasks; - this.coroutineHost = coroutineHost; } - public TaskBundle(MonoBehaviour coroutineHost, List tasks, List> preconditions) + public TaskBundle(List tasks, List> preconditions) { this.State = TaskState.Waiting; TaskQueue = tasks; this.Preconditions = preconditions; - this.coroutineHost = coroutineHost; } /// @@ -53,14 +48,9 @@ public TaskBundle(MonoBehaviour coroutineHost, List tasks, List tasks)` -3. `TaskBundle(MonoBehaviour coroutineHost, List tasks, List> preconditions)` +1. `TaskBundle()` +2. `TaskBundle(List tasks)` +3. `TaskBundle(List tasks, List> preconditions)` -The `coroutineHost` is the MonoBehaviour that will host the coroutine that executes the TaskBundle. `tasks` is a list of subtasks. Of note is, that TaskActions cannot be used here, as they would also add the sub-tasks to the regular scheduler. `preconditions` is a list of boolean functions, so in particular lambda expressions can be used. Other functions may be evaluated beforehand, so are not suitable for this purpose.