Пример #1
0
        public static bool InspirationToPlayer(NicheType nicheType, GameContext gameContext)
        {
            var inspirationChance = 6;

            if (inspirationChance > Random.Range(0, 100))
            {
                return(NotificationUtils.SendInspirationPopup(gameContext, nicheType));
            }

            return(false);
        }
Пример #2
0
        public static void TryToSpawnCompany(GameEntity niche, GameContext gameContext, MarketState phase, int playersOnMarket)
        {
            var leaderFunds = Random.Range(5000, 300000);

            bool leaderHasEnoughMoney = GetStartCapital(niche, gameContext) <= leaderFunds;

            if (IsNeedsMoreCompaniesOnMarket(niche, gameContext, phase, playersOnMarket) && leaderHasEnoughMoney)
            {
                var product = SpawnCompany(niche, gameContext, leaderFunds);

                NotificationUtils.SendNewCompetitorPopup(gameContext, niche, product);
            }
        }
Пример #3
0
        public static void NotifyAboutAcquisition(GameContext gameContext, GameEntity buyer, GameEntity target, long bid)
        {
            NotificationUtils.AddNotification(gameContext, new NotificationMessageBuyingCompany(target.company.Id, buyer.shareholder.Id, bid));

            if (IsInPlayerSphereOfInterest(target, gameContext))
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfCompanyInOurSphereOfInfluence(target.company.Id, buyer.shareholder.Id, bid));
            }


            Debug.LogFormat("ACQUISITION: {0} bought {1} for {2}!",
                            GetInvestorName(buyer),
                            target.company.Name,
                            Format.Money(bid));
        }
Пример #4
0
        public static void NotifyAboutCorporateAcquisition(GameContext gameContext, GameEntity corporation, int targetCompanyId)
        {
            NotificationUtils.AddNotification(gameContext, new NotificationMessageBuyingCompany(targetCompanyId, corporation.shareholder.Id, 0));

            var company = Get(gameContext, targetCompanyId);

            if (IsInPlayerSphereOfInterest(company, gameContext))
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfCompanyInOurSphereOfInfluence(targetCompanyId, corporation.shareholder.Id, 0));
            }


            Debug.LogFormat("CORPORATE ACQUISITION: {0} integrated {1}!",
                            GetInvestorName(corporation),
                            company.company.Name);
        }
Пример #5
0
        public static void UpdateMarketRequirements(GameEntity product, GameContext gameContext)
        {
            var niche = Markets.Get(gameContext, product.product.Niche);

            var demand   = Products.GetMarketDemand(niche);
            var newLevel = Products.GetProductLevel(product);

            if (newLevel > demand)
            {
                bool revolution = newLevel - demand > 1;

                // innovation
                //var clientChange = GiveInnovationBenefits(product, gameContext, revolution);
                var brandGain = revolution ? C.REVOLUTION_BRAND_POWER_GAIN : C.INNOVATION_BRAND_POWER_GAIN;
                Marketing.AddBrandPower(product, brandGain);

                // notify about innovation
                var player    = Companies.GetPlayerCompany(gameContext);
                var daughters = Companies.GetDaughtersAmount(player);


                //if (Companies.IsInPlayerSphereOfInterest(product, gameContext) && Markets.GetCompetitorsAmount(product, gameContext) > 1 && daughters == 1)
                //    NotificationUtils.AddPopup(gameContext, new PopupMessageInnovation(product.company.Id, clientChange));

                // && Markets.GetCompetitorsAmount(product, gameContext) > 1 && daughters == 1
                if (Companies.IsInPlayerSphereOfInterest(product, gameContext))
                {
                    NotificationUtils.AddNotification(gameContext, new NotificationMessageInnovation(product.company.Id, newLevel, revolution, 0, brandGain));
                }

                niche.ReplaceSegment(newLevel);

                // order matters
                RemoveTechLeaders(product, gameContext);
                product.isTechnologyLeader = true;
            }
            else if (newLevel == demand)
            {
                // if you are techonology leader and you fail to innovate, you will not lose tech leadership
                if (product.isTechnologyLeader)
                {
                    return;
                }

                RemoveTechLeaders(product, gameContext);
            }
        }
        public static void NotifyAboutAcquisition(GameContext gameContext, int buyerShareholderId, int targetCompanyId, long bid)
        {
            NotificationUtils.AddNotification(gameContext, new NotificationMessageBuyingCompany(targetCompanyId, buyerShareholderId, bid));

            var company = Get(gameContext, targetCompanyId);

            if (IsInPlayerSphereOfInterest(company, gameContext))
            {
                NotificationUtils.AddPopup(gameContext, new PopupMessageAcquisitionOfCompanyInOurSphereOfInfluence(targetCompanyId, buyerShareholderId, bid));
            }


            Debug.LogFormat("ACQUISITION: {0} bought {1} for {2}!",
                            GetInvestorName(gameContext, buyerShareholderId),
                            Get(gameContext, targetCompanyId).company.Name,
                            Format.Money(bid));
        }
Пример #7
0
        public static void TweakCorporatePolicy(GameContext gameContext, GameEntity company, CorporatePolicy policy, int value)
        {
            if (Cooldowns.HasCorporateCultureUpgradeCooldown(gameContext, company))
            {
                return;
            }

            Cooldowns.AddCorporateCultureUpgradeCooldown(gameContext, company, Balance.CORPORATE_CULTURE_CHANGES_DURATION);
            var culture = GetOwnCorporateCulture(company);

            var prevValue = culture[policy];

            culture[policy] = Mathf.Clamp(value, Balance.CORPORATE_CULTURE_LEVEL_MIN, Balance.CORPORATE_CULTURE_LEVEL_MAX);

            if (value != prevValue)
            {
                // culture changed
                NotificationUtils.AddPopup(gameContext, new PopupMessageCultureChange(company.company.Id));
            }

            company.ReplaceCorporateCulture(culture);
        }
Пример #8
0
 public static void NotifyAboutProductSupportEnd(GameEntity company, GameContext gameContext)
 {
     NotificationUtils.AddNotification(gameContext, new NotificationMessageBankruptcy(company.company.Id));
     NotificationUtils.SendBankruptcyPopup(gameContext, company);
 }
Пример #9
0
 public static void NotifyAboutPartnershipResponse(GameEntity requester, GameEntity acceptor, bool willAccept, GameContext gameContext)
 {
     NotificationUtils.AddPopup(gameContext, new PopupMessageStrategicPartnership(requester.company.Id, acceptor.company.Id, willAccept));
 }