예제 #1
0
    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;
    }
예제 #2
0
 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);
     }
 }
예제 #3
0
    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;
        }
    }
예제 #4
0
    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);
    }