private void HandleIncomingCarrier(CarrierAnt carrier) { if (carrier.Target == transform || carrier.Target == null) { AntDispatcher.ProvideCarrier(carrier); } }
private void HandleIncomingBuilder(BuilderAnt builder) { if (builder.Target == transform || builder.Target == null) { /* * The AntDispatcher.Destroy call is obsolete * * Implement: * AntDispatcher.ProvideBuilder(builder); * * This method cares about sending builder to next construction or destroys the go. */ AntDispatcher.Destroy(builder); } }
void Update() { if (WorkerAnts == 0) { return; } Percentage += WorkerAnts * Time.deltaTime * FarmingSpeed; if (Percentage >= 1) { Percentage--; Food++; AntDispatcher.RequestCarrier(gameObject); } FarmProperty.UpdateStats(this); }
private void HandleIncomingWorker(WorkerAnt worker) { if (worker.Target != transform) { return; } lock (_Sync) { if (WorkerAnts == MaxWorkerAnts) { AntDispatcher.ToBase(worker); } else { WorkerAnts++; AntDispatcher.Destroy(worker); } } }
private void OnTriggerEnter2D(Collider2D collision) { BuilderAnt ant = collision.gameObject.GetComponent <BuilderAnt>(); if (ant == null) { return; } if (ant.Target != transform) { return; } BuilderAnts++; AntDispatcher.Destroy(ant); ConstructionAreaProperty.UpdateStats(this); }
private void SetupNewBuilding() { GameObject go = Instantiate(BuildingPrefab, transform.parent); go.transform.position = transform.position; FarmBuilding farm = go.GetComponent <FarmBuilding>(); if (farm != null) { farm.enabled = true; } if (ConstructionAreaProperty.IsActiveFor(this)) { PropertyManager.OpenFor(go); } Destroy(gameObject); AntDispatcher.ToBase(transform, BuilderAnts); }
void Start() { AntDispatcher.RequestWorker(this, MaxWorkerAnts); }
void Start() { ConstructionAreaProperty.Load(); AntDispatcher.RequestBuilder(this, 3); }