Example #1
0
 /// <summary>
 /// Spawns the worker agent.
 /// </summary>
 /// <param name="workerAgent">The worker agent.</param>
 private void SpawnWorkerAgent(WorkerAgent workerAgent)
 {
     this.agent            = GameObject.Instantiate <WorkerAgent> (workerAgent, position: storages [startAtStorageIndex].GetPosition(), rotation: Quaternion.identity, parent: WorkerContainer.Instance.transform);
     agent.OnAgentClicked += StartWorkCoroutine;
 }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WorkerController"/> class.
        /// </summary>
        public WorkerController(List <IStorage> storages, Queue <AbstractTask> tasks, WorkerAgent workerAgent, int startAtStorageIndex)
        {
            this.storages            = storages;
            this.tasks               = tasks;
            this.startAtStorageIndex = startAtStorageIndex;

            SpawnWorkerAgent(workerAgent);

            this.temporaryStorage = new WorkerStorage(Agent);

            // work once on start
            StartWorkCoroutine();
        }