Пример #1
0
        public static void SendJobOffer(HumanFF worker, JobOffer jobOffer, GameEntity company, GameContext gameContext)
        {
            var offer = new ExpiringJobOffer
            {
                JobOffer     = jobOffer,
                CompanyId    = company.company.Id,
                DecisionDate = ScheduleUtils.GetCurrentDate(gameContext) + 30,
                HumanId      = worker.HumanComponent.Id
            };

            AddOrReplaceOffer(company, worker, offer);
        }
Пример #2
0
    internal void SetEntity(ExpiringJobOffer entity)
    {
        var human = SelectedHuman;

        CompanyTitle.text = RenderName(Companies.Get(Q, entity.CompanyId));
        Offer.text        = Format.Money(entity.JobOffer.Salary, true) + " / week";

        var opinionBonus = Teams.GetOpinionAboutOffer(human, entity);
        var opinion      = (int)opinionBonus.Sum();

        Opinion.text  = Format.Sign(opinion);
        Opinion.color = Visuals.GetColorPositiveOrNegative(opinion);
        OpinionHint.SetHint(opinionBonus.ToString());
    }
Пример #3
0
        public static void AddOrReplaceOffer(GameEntity company, HumanFF human, ExpiringJobOffer o)
        {
            int index = human.WorkerOffersComponent.Offers
                        .FindIndex(o1 => o1.CompanyId == company.company.Id && o1.HumanId == human.HumanComponent.Id);

            if (index == -1)
            {
                human.WorkerOffersComponent.Offers.Add(o);
            }
            else
            {
                human.WorkerOffersComponent.Offers[index] = o;
            }

            //Debug.Log($"Offer to {Humans.GetFullName(human)} ({human.workerOffers.Offers.Count}): {company.company.Name}");
        }
Пример #4
0
        public static void SetJobOffer(HumanFF human, GameEntity company, JobOffer offer, int teamId, GameContext gameContext)
        {
            var o = new ExpiringJobOffer
            {
                Accepted = true,

                JobOffer     = offer,
                CompanyId    = company.company.Id,
                HumanId      = human.HumanComponent.Id,
                DecisionDate = -1
            };

            AddOrReplaceOffer(company, human, o);

            Economy.UpdateSalaries(company, gameContext);
        }
        public static Bonus <float> GetOpinionAboutOffer(HumanFF worker, ExpiringJobOffer newOffer)
        {
            bool willNeedToLeaveCompany = worker.WorkerComponent.companyId != newOffer.CompanyId;

            var bonus = new Bonus <float>("Opinion about offer");

            // scenarios
            // 1 - unemployed
            // 2 - employed, same company
            // 3 - employed, recruiting
            // 4 - !founder

            if (!Humans.IsEmployed(worker))
            {
                return(bonus.Append("Salary", newOffer.JobOffer.Salary > GetSalaryPerRating(worker) ? 1 : -1));
            }

            int loyaltyBonus         = (worker.HumanCompanyRelationshipComponent.Morale - 50) / 10;
            int desireToLeaveCompany = 0;

            if (willNeedToLeaveCompany)
            {
                // it's not easy to recruit worker from other company
                desireToLeaveCompany -= 5;

                // and if your worker loves stability...
                if (Humans.HasTrait(worker, Trait.Loyal))
                {
                    desireToLeaveCompany -= 5;
                }

                // but if your worker loves new challenges...
                if (Humans.HasTrait(worker, Trait.NewChallenges))
                {
                    desireToLeaveCompany += 10;
                }

                if (desireToLeaveCompany > 0)
                {
                    bonus.AppendAndHideIfZero("Wants to leave company", desireToLeaveCompany);
                }
                else
                {
                    bonus.AppendAndHideIfZero("Wants to stay in company", desireToLeaveCompany);
                }

                bonus.Append("Loyalty to company", -loyaltyBonus);
            }
            else
            {
                // prolongation of contract
                bonus.Append("Loyalty to company", loyaltyBonus);
            }

            long newSalary = newOffer.JobOffer.Salary;

            long salary;

            salary = (long)Mathf.Max(Humans.GetCurrentOffer(worker).JobOffer.Salary, 1);

            float salaryRatio;

            salaryRatio = (newSalary - salary) * 1f / salary;
            salaryRatio = Mathf.Clamp(salaryRatio, -5, 5);

            bonus.Append("Salary", salaryRatio);


            return(bonus);
        }