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


C# Hex.GetTotalLocalPopulation方法代码示例

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


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

示例1: CalculateBitesize

    private float CalculateBitesize(Hex Habitat)
    {
        float required = (Habitat.GetTotalLocalPopulation() * .12f * baseFoodValue);

        return required;
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:6,代码来源:Critter.cs

示例2: RankPrey

    //Ranks Prey based on local creatures stats and population to find the best targets
    public void RankPrey(Hex hex)
    {
        float deviation;
        float huntScore = 0;
        float popCut;
        float popScore;
        float tastiness = 0;
        float availPop = hex.GetTotalLocalPopulation() - GetLocalPopulation(hex);
        float totalCritters = hex.localCritters.Count;
        float critterCut = 100 / (totalCritters - 1);

        Critter spot;

        if(HuntScoreList.Capacity != totalCritters){
            HuntScoreList.Clear();
        }

        HuntScoreList.TrimExcess();

        for(int n = 0; n < totalCritters; n++){
            spot = hex.localCritters[n];

            if(spot != this){
                popScore = 0;
                huntScore = HuntScore(spot);

                float sneakiness = 100f - spot.SneakScore(this);
                popCut = (100 * spot.GetLocalPopulation(hex) / availPop);

                tastiness = (huntScore - sneakiness);

                deviation = popCut - critterCut;

                if(deviation >= 0){
                    popScore = 100 * (Mathf.Pow(deviation, 1.5f));
                    popScore = (Mathf.Round(popScore)) / 100;
                }
                else if(deviation < 0){
                    popScore = 0;
                }

                tastiness = (Mathf.Pow(tastiness / 10, 2f) + popScore);

                if(isPlayer){
                    //print(spot.name + "'s huntscore = " + huntScore + " vs tastiness = " + tastiness + "\r\n");
                }

                huntScore = ((tastiness) / 2) * 10 * AptitudeCheck(spot);

                dietType[] diet = spot.GetDiet();

                for(int i = 0; i < diet.Length; i++){
                    if(diet[i] == dietType.CARNO || diet[i] == dietType.SCAV){
                    huntScore = huntScore * .5f;
                        break;
                    }
                }

                huntScore = (Mathf.Round(10 * huntScore));

                HuntScoreList.Add(huntScore);
            } else{
                huntScore = 0;
                HuntScoreList.Add(0);
            }
        }

        HuntScoreList.TrimExcess();
        HuntChanceList.TrimExcess();
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:71,代码来源:Critter.cs


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