diff --git a/Assets/Scripts/Gameplay/Quests/Tasks/Task.cs b/Assets/Scripts/Gameplay/Quests/Tasks/Task.cs index 0d7e7c32..572e6365 100644 --- a/Assets/Scripts/Gameplay/Quests/Tasks/Task.cs +++ b/Assets/Scripts/Gameplay/Quests/Tasks/Task.cs @@ -1,11 +1,11 @@ using System; +using Gameplay.Quests.Tasks.TaskHelper.TasksModules; using Gameplay.Quests.Tasks.TasksType; -using ScriptableObjects.Quests; using UnityEngine; namespace Gameplay.Quests.Tasks { - public class Task : ScriptableObject + public class Task : MonoBehaviour { public delegate void TaskProgressChanged(Task task); public delegate void StatusChanged(TaskStatus newStatus, Task task); @@ -50,11 +50,20 @@ public virtual void Activate() { _startTime = DateTime.Now; Status = TaskStatus.Active; + ActivateTaskModules(); } else if (Status == TaskStatus.Completed) Debug.Log("[Task] Activate(): Task is already completed"); } + private void ActivateTaskModules() + { + foreach (var taskModule in GetComponentsInChildren()) + { + taskModule.Activate(this); + } + } + public virtual bool CanComplete() { return Status == TaskStatus.Active;