Example #1
0
    void TestApplications(Job job)
    {
        //arrange based on total stats
        SortApplicationsBasedOnStats(job);

        //accept applications
        for (int a = 0; a < job.applications.Count; a++)
        {
            if (job.requiredWorkers == 0)
            {
                job.applications.Clear();
                return;
            }

            job.AddWorker(job.applications [0]);

            //setup worker data
            job.applications [0].stats.income  = job.pay;
            job.applications [0].stats.company = this;
            job.applications [0].stats.job     = job;
            job.applications [0].recalculateSleep();

            job.applications [0].resetApplications();

            job.requiredWorkers--;
        }
    }
Example #2
0
        public void CreateJob()
        {
            string jobName = Prompt("Enter the name of the job:");
            Job    job     = new Job(jobName);

            Assembly automationAssembly = typeof(Job).Assembly;

            Type[]      allTypes    = automationAssembly.GetTypes();
            List <Type> workerTypes = new List <Type>();

            allTypes.Each((type) =>
            {
                if (type.ImplementsInterface <IWorker>())
                {
                    workerTypes.Add(type);
                }
            });

            workerTypes.Each((wt, i) => OutLineFormat("{0}. {1}", ConsoleColor.Cyan, i + 1, wt.Name));

            int workTypeIndex = NumberPrompt("Select work to add");

            if (workTypeIndex <= 0)
            {
                Out("Invalid selection", ConsoleColor.Red);
            }
            string workName  = Prompt("Enter a name for the work");
            Type   workToAdd = workerTypes[workTypeIndex - 1];
            object work      = workToAdd.Construct(workName);

            job.AddWorker((IWorker)work);
        }
 public virtual void OnAddWorkersUp()
 {
     _parentJob.AddWorker();
     _gameSignals.EmitSignal(nameof(GameSignals.UpdateUI));
 }