Beispiel #1
0
        public static void ShaffleEmployees(GameEntity company, GameContext gameContext)
        {
            //Debug.Log("ShaffleEmployees: " + company.company.Name + " " + company.company.Id);

            #region remove previous employees
            foreach (var humanId in company.employee.Managers.Keys)
            {
                var h = Humans.GetHuman(gameContext, humanId);

                h.Destroy();
            }

            //Debug.Log("ShaffleEmployees: will remove " + company.employee.Managers.Keys.Count + " employees");

            company.employee.Managers.Clear();
            #endregion

            var roles = GetRolesTheoreticallyPossibleForThisCompanyType(company);

            for (var i = 0; i < roles.Count; i++)
            {
                var index = Random.Range(0, roles.Count);

                var role = roles[index];

                var worker  = Humans.GenerateHuman(gameContext, role);
                var humanId = worker.human.Id;

                //Debug.Log($"human #{i} - {role}. Human Id = {humanId}");

                company.employee.Managers[humanId] = role;
            }

            //Debug.Log("ShaffleEmployees: " + company.company.Name + " DONE");
        }
Beispiel #2
0
        // TODO remove
        public static void SetFounderAmbitionDueToMarketSize(GameEntity company, GameContext gameContext)
        {
            var niche  = Markets.GetNiche(gameContext, company.product.Niche);
            var rating = Markets.GetMarketPotentialRating(niche);


            var rand = UnityEngine.Random.Range(1f, 2f) * 5;

            // 5...25
            var ambition = 65 + Mathf.Clamp(rating * rand, 0, 30);
            var CeoId    = GetCEOId(company);

            var ceo = Humans.GetHuman(gameContext, CeoId);

            Humans.SetTrait(ceo, TraitType.Ambitions, (int)ambition);
        }
Beispiel #3
0
        public static void AutoFillShareholders(GameContext gameContext, GameEntity c, bool founderOnly)
        {
            var founder     = c.cEO.HumanId;
            var shareholder = Humans.GetHuman(gameContext, founder);

            Investments.BecomeInvestor(gameContext, shareholder, 100000);

            AddShareholder(gameContext, c.company.Id, shareholder.shareholder.Id, 500);

            if (founderOnly)
            {
                return;
            }

            for (var i = 0; i < UnityEngine.Random.Range(1, 5); i++)
            {
                int investorId = Investments.GetRandomInvestmentFund(gameContext);

                AddShareholder(gameContext, c.company.Id, investorId, 100);
            }
        }
Beispiel #4
0
 public static void FireManager(GameEntity company, GameContext gameContext, int humanId) => FireManager(company, Humans.GetHuman(gameContext, humanId));
Beispiel #5
0
        public static GameEntity GetSelectedHuman(GameContext gameContext)
        {
            var humanId = (int)GetScreenData(gameContext)[Balance.MENU_SELECTED_HUMAN];

            return(Humans.GetHuman(gameContext, humanId));
        }