Ejemplo n.º 1
0
    void Start()
    {
        center.agentsCounter[name]++;

        // Find sawmill or HunyerShed to work
        SawmillBuilding[] sawmills = (SawmillBuilding[])FindObjectsOfType(typeof(SawmillBuilding));
        foreach (SawmillBuilding saw in sawmills)
        {
            if (!saw.blueprint.done || saw.carriers >= saw.limitCarriers)
            {
                continue;
            }
            sawmill = saw;
            sawmill.carriers++;
            break;
        }
        if (sawmill == null)
        {
            HuntingShedBuilding[] huntingSheds = (HuntingShedBuilding[])FindObjectsOfType(typeof(HuntingShedBuilding));
            foreach (HuntingShedBuilding shed in huntingSheds)
            {
                if (!shed.blueprint.done || shed.carriers >= shed.limitCarriers)
                {
                    continue;
                }
                huntingShed = shed;
                huntingShed.carriers++;
                break;
            }
            // No building found, turn waiting
            if (huntingShed == null)
            {
                waiting = true;
            }
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        center.agentsCounter[name]++;

        // Find HuntingShed
        HuntingShedBuilding[] huntingSheds = (HuntingShedBuilding[])FindObjectsOfType(typeof(HuntingShedBuilding));
        foreach (HuntingShedBuilding shed in huntingSheds)
        {
            if (!shed.blueprint.done)
            {
                continue;
            }
            huntingShed = shed;
            huntingShed.hunters++;
            break;
        }
        // If not found send building request
        if (huntingShed == null)
        {
            Building building = new Building("Prefabs/Buildings/huntingShed", 250, 150, 7, 2);
            center.addNewBuildingRequest(building);
        }
        moveSpeed = 1;
    }