Exemplo n.º 1
0
 private void HandleIncomingCarrier(CarrierAnt carrier)
 {
     if (carrier.Target == transform || carrier.Target == null)
     {
         AntDispatcher.ProvideCarrier(carrier);
     }
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 3
0
    void Update()
    {
        if (WorkerAnts == 0)
        {
            return;
        }

        Percentage += WorkerAnts * Time.deltaTime * FarmingSpeed;

        if (Percentage >= 1)
        {
            Percentage--;
            Food++;

            AntDispatcher.RequestCarrier(gameObject);
        }

        FarmProperty.UpdateStats(this);
    }
Exemplo n.º 4
0
    private void HandleIncomingWorker(WorkerAnt worker)
    {
        if (worker.Target != transform)
        {
            return;
        }

        lock (_Sync)
        {
            if (WorkerAnts == MaxWorkerAnts)
            {
                AntDispatcher.ToBase(worker);
            }
            else
            {
                WorkerAnts++;
                AntDispatcher.Destroy(worker);
            }
        }
    }
Exemplo n.º 5
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);
    }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
 void Start()
 {
     AntDispatcher.RequestWorker(this, MaxWorkerAnts);
 }
Exemplo n.º 8
0
    void Start()
    {
        ConstructionAreaProperty.Load();

        AntDispatcher.RequestBuilder(this, 3);
    }