示例#1
0
    void Update()
    {
        if (BuilderAnts == 0)
        {
            return;
        }

        BuildingTimeSecs  += BuilderAnts * Time.deltaTime;
        BuildingPercentage = BuildingTimeSecs / BUILDING_TIME_SECS;

        if (BuildingPercentage >= 1)
        {
            SetupNewBuilding();
        }
        else
        {
            ConstructionAreaProperty.UpdateStats(this);
        }
    }
示例#2
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);
    }
示例#3
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);
    }
示例#4
0
 protected void OnMouseUp()
 {
     ConstructionAreaProperty.Activate(this);
 }
示例#5
0
    void Start()
    {
        ConstructionAreaProperty.Load();

        AntDispatcher.RequestBuilder(this, 3);
    }