Hi there !
I am studying the excellent Turn Based Strategy Game (thank you guys i am learning a lot and it’s very clear) and I am trying to adapt it a little bit to have a Task AI mechanic on non player Units.
The goal is to have prefabs placed on the grid that under certain conditions/events increment a task list indicating these specific non player units (workers) grid positions where they will walk and play an animation after reaching their destination. The units will go on to the next task then once the animation is performed.
I am re-following the TBS course and stopping at the beginning for now at the "Single active action "chapter as I am also trying to combine it with Code Monkey’s tutorial on “Task System in Battle Royale Tycoon” which can be found here on Youtube: Task System
The debug part works for me (until 4:20), then Hugo implements it’s own Worker model and animation, that is where I failed in adapting the standard “Unit” character that we have implemented in the course.
I want to replace 2 things for now : the 2D worker and it’s movement system.
I’ve changed my interface : CM_IWorker to have the method from the TBS tutorial MoveAction “Move(GridPosition gridposition, OnActionComplete)” instead of the MoveTo(Vector 3, OnArrivedAtPosition) from the video and CodeMonkey’s animation project.
More precisely, I am trying to replace
//CM_Worker worker = CM_Worker.Create(new Vector3(500,500)); with a reference to the a Unit prefab :
namespace CM_TaskSystem {
public class CM_GameHandler : MonoBehaviour
{
private Unit worker;
private void Start()
{
worker = GetComponent < Unit > ();
CM_TaskSystem taskSystem = new CM_TaskSystem();
CM_WorkerTaskAi workerTaskAi = worker.gameObject.AddComponent<CM_WorkerTaskAi>();
workerTaskAi.Setup(worker);
}
}
}
the error i am getting is :
Assets/Scripts/TaskManager/CM_GameHandler.cs(25,28): error CS1503: Argument 1: cannot convert from ‘Unit’ to ‘CM_TaskSystem.CM_IWorker’
I tried to change few things, it might be because we definined the “Unit” as a protected type, if it might be the reason, how can I adapt it please ?
Could you please help me on that one ?
Thank you in advance for the help !