private static void CreateBuilderAnt(Transform target, Transform source) { GameObject go = new GameObject("Builder", typeof(BuilderAnt)); BuilderAnt ant = go.GetComponent <BuilderAnt>(); ant.Target = target; ant.Source = source; }
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); } }
private void OnTriggerEnter2D(Collider2D collision) { BuilderAnt builder = collision.gameObject.GetComponent <BuilderAnt>(); if (builder != null) { HandleIncomingBuilder(builder); return; } CarrierAnt carrier = collision.gameObject.GetComponent <CarrierAnt>(); if (carrier != null) { HandleIncomingCarrier(carrier); return; } }
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); }