Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class CreateWorker<T> : MonoBehaviour where T: WorkerBaseController
- {
- [SerializeField]
- protected T workerBaseObj;
- [SerializeField] protected Transform workerParent;
- private void Start()
- {
- StartCoroutine(CreateWorkerObj());
- }
- protected abstract IEnumerator CreateWorkerObj();
- }
- public class CreateKitchenWorker : CreateWorker<WorkerKitchenController>
- {
- [SerializeField] private Transform plateLoaderTransform;
- [SerializeField] private GatherIngredients gatherIngredients;
- [SerializeField] private CollectAndCook collectAndCook;
- protected override IEnumerator CreateWorkerObj()
- {
- yield return new WaitForSeconds(3f);
- var workerBaseController = Instantiate(workerBaseObj, workerParent);
- workerBaseController.transform.localPosition = Vector3.zero;
- workerBaseController.name = "worker";
- workerBaseController.Initialize(2, 8, plateLoaderTransform, gatherIngredients, collectAndCook);
- yield return new WaitForSeconds(1f);
- workerBaseController = Instantiate(workerBaseObj, workerParent);
- workerBaseController.transform.localPosition = Vector3.zero;
- workerBaseController.name = "worker";
- workerBaseController.Initialize(2, 8, plateLoaderTransform, gatherIngredients, collectAndCook);
- }
- }
- public class CreateCustomerServiceWorker : CreateWorker<WorkerCustomerServiceController>
- {
- protected override IEnumerator CreateWorkerObj()
- {
- yield return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement