コード例 #1
0
    public override void VisitBuilding(int a, int b)
    {
        House     h = world.Map.GetBuildingAt(a, b).GetComponent <House>();
        Workplace w = (Workplace)Origin;

        if (laborSeeker && w != null && h != null)
        {
            if (w.WorkerList.Count == w.workersMax)
            {
                //if this is ONLY a laborseeker and it is not returning home yet, make it go home by setting its lifetime to 0
                if (!data.ReturningHome && name.Contains("LaborSeeker"))
                {
                    lifeTime = 0;
                }

                //then don't bother continuing
                return;
            }

            foreach (Prole p in h.Residents)
            {
                if (p == null)
                {
                    continue;
                }
                if (p.GetLaborScore(w.laborType) < w.minimumAbility)                    //if this prole's labor type is not preferred and we will not hire proles with unpreferred types, continue
                {
                    continue;
                }
                if (p.SeekingWork)
                {
                    w.AddWorker(p);
                }
            }
        }
    }