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


C# IPlayer.GetSource方法代码示例

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


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

示例1: GetDesirability

        public double GetDesirability(IPlayer player)
        {
            if (map.GetPlayerMe().GetBuildingCount(Building.Fort) == 0)
                return 0.0;

            int sum = 0;
            int sourceHim;
            int sourceMe;
            ISourceAll source = player.GetSource();
            IPlayer me = map.GetPlayerMe();

            for (int loop1 = 0; loop1 < 5; loop1++)
            {
                sourceHim = source.Get((SourceKind)loop1);
                sourceMe = me.GetCollectSourcesNormal().Get((SourceKind)loop1);

                sum += (sourceMe <= 16) ? sourceHim * 2 : sourceHim;
            }

            double result = (sum - 2 * AIGen.SumVector(map.GetPrice(PriceKind.AStealSources).GetAsArray())) / 200.0;
            if (result < 0.0)
                result = 0.0;
            else
                if (result > 1.0)
                    result = 1.0;

            return result;
        }
开发者ID:alenkacz,项目名称:Expanze,代码行数:28,代码来源:FortStealSources.cs

示例2: GetFitness

        public static float GetFitness(IPlayer player)
        {
            if (map.GetPlayerOthers().Count == 0)
                return 0.0f;

            int sum = 0;
            int sourceHim;
            int sourceMe;
            ISourceAll source = player.GetSource();
            IPlayer me = map.GetPlayerMe();

            for (int loop1 = 0; loop1 < 5; loop1++)
            {
                sourceHim = source.Get((SourceKind)loop1);
                sourceMe = me.GetCollectSourcesNormal().Get((SourceKind)loop1);
                sum += (sourceMe <= 16) ? sourceHim * 2 : sourceHim;
            }

            float result = sum / 2000.0f;
            if (result > 1.0f)
                result = 1.0f;

            return result;
        }
开发者ID:alenkacz,项目名称:Expanze,代码行数:24,代码来源:Fitness.cs

示例3: HasPlayerSources

        public Boolean HasPlayerSources(IPlayer player)
        {
            if (player == null)
                return false;

            ISourceAll sourcePlayer = player.GetSource();

            return sourcePlayer.GetCorn() >= corn &&
                   sourcePlayer.GetMeat() >= meat &&
                   sourcePlayer.GetOre() >= ore &&
                   sourcePlayer.GetStone() >= stone &&
                   sourcePlayer.GetWood() >= wood;
        }
开发者ID:alenkacz,项目名称:Expanze,代码行数:13,代码来源:SourceCost.cs


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