当前位置: 首页>>代码示例>>C#>>正文


C# Scenario.GetValue方法代码示例

本文整理汇总了C#中Scenario.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Scenario.GetValue方法的具体用法?C# Scenario.GetValue怎么用?C# Scenario.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scenario的用法示例。


在下文中一共展示了Scenario.GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Perform

        public void Perform(Scenario scenario, ScenarioFrame frame, string name, SimDescription sim, SimDescription target)
        {
            scenario.IncStat(name);

            foreach (KeyValuePair<BuffNames, Origin> value in mActorBuffs)
            {
                HandleBuff(sim.CreatedSim, value.Key, value.Value);
            }

            foreach (KeyValuePair<BuffNames, Origin> value in mTargetBuffs)
            {
                HandleBuff(target.CreatedSim, value.Key, value.Value);
            }

            mRecruit.Perform(scenario, sim, target);

            mPropagate.Perform(scenario, frame, sim, target);

            int minCelebrity = scenario.GetValue<ManagerPersonality.MinCelebrityOption, int>();

            if (minCelebrity > 0)
            {
                SimPersonality personality = scenario.Manager as SimPersonality;

                int actorCelebrity = mActorCelebrity;
                if (actorCelebrity < minCelebrity)
                {
                    actorCelebrity = minCelebrity;
                }

                if (actorCelebrity > 0)
                {
                    scenario.Friends.AccumulateCelebrity(sim, actorCelebrity);
                }

                if ((personality != null) && (personality.Me != sim))
                {
                    scenario.Friends.AccumulateCelebrity(personality.Me, actorCelebrity);
                }

                int targetCelebrity = mTargetCelebrity;
                if (targetCelebrity < minCelebrity)
                {
                    targetCelebrity = minCelebrity;
                }

                if (targetCelebrity > 0)
                {
                    scenario.Friends.AccumulateCelebrity(target, targetCelebrity);
                }
            }

            if (mAccumulatorOptions != null)
            {
                foreach (SimPersonality.IAccumulatorValue value in mAccumulatorOptions)
                {
                    value.ApplyAccumulator();
                }
            }

            Scenario newScenario = GetNewScenario(scenario.Manager, sim, target);
            if (newScenario != null)
            {
                scenario.IncStat(newScenario.UnlocalizedName);

                scenario.Add(frame, newScenario, ScenarioResult.Start);
            }

            SimPersonality clan = scenario.Manager as SimPersonality;
            if ((sim != clan.Me) && (clan != null) && (clan.IsFriendlyLeadership))
            {
                int delta = mDelta.Score(new DualSimScoringParameters(sim, clan.Me));

                if (delta < 0)
                {
                    scenario.IncStat("ExistingEnemy");

                    scenario.Add(frame, new ExistingEnemyManualScenario(sim, clan.Me, delta, 0), ScenarioResult.Start);
                }
                else if (delta > 0)
                {
                    scenario.IncStat("ExistingFriend");

                    scenario.Add(frame, new ExistingFriendManualScenario(sim, clan.Me, delta, 0), ScenarioResult.Start);
                }
            }

            scenario.Add(frame, new SuccessScenario(), ScenarioResult.Start);
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:89,代码来源:WeightScenarioHelper.cs


注:本文中的Scenario.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。