Ejemplo n.º 1
0
        static void DisableTask(GameEntity product, GameContext gameContext, TeamTask task)
        {
            //Debug.Log($"Disabling task {task.ToString()} from {product.company.Name}");

            if (task.IsMarketingTask)
            {
                var activity = task as TeamTaskChannelActivity;

                var channel = Markets.GetMarketingChannel(gameContext, activity.ChannelId);
                
                Marketing.DisableChannelActivity(product, channel);
            }

            if (task.IsFeatureUpgrade)
            {
                var activity = task as TeamTaskFeatureUpgrade;


                //var channel = Markets.GetMarketingChannels(gameContext).First(c => c.marketingChannel.ChannelInfo.ID == activity.ChannelId);
                //Products.DisableChannelActivity(product, gameContext, channel);
            }

            if (task.IsHighloadTask || task.IsSupportTask)
            {
                var activity = task as TeamTaskSupportFeature;

                var upgrades = product.supportUpgrades.Upgrades;

                var name = activity.SupportFeature.Name;
                if (upgrades.ContainsKey(name))
                {
                    upgrades[name]--;
                }

                if (upgrades[name] <= 0)
                {
                    upgrades.Remove(name);
                }
            }
        }