Beispiel #1
0
 void Start()
 {
     center.agentsCounter[name]++;
     // Find sawmill building
     SawmillBuilding[] sawmills = (SawmillBuilding[])FindObjectsOfType(typeof(SawmillBuilding));
     foreach (SawmillBuilding saw in sawmills)
     {
         if (!saw.blueprint.done)
         {
             continue;
         }
         sawmill = saw;
         sawmill.workers++;
         break;
     }
     // If not found send building request
     if (sawmill == null)
     {
         Building building = new Building("Prefabs/Buildings/Sawmill", 200, 150, 5, 2);
         center.addNewBuildingRequest(building);
     }
 }
Beispiel #2
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;
            }
        }
    }