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


C# Hex.GetClimateVal方法代码示例

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


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

示例1: CritterSurvivalCheck

    public float CritterSurvivalCheck(Hex habitat)
    {
        float score = 0;

        int biome = (int)habitat.GetBiomeType();
        int climate = (int)habitat.GetClimateVal();
        int geo = (int)habitat.GetGeography();
        int temp = (int)habitat.GetTempVal();

        score += biomePref[biome];
        score += GetClimatePref(climate);
        score += geoPref[geo];
        score += GetTempPref(temp);

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

示例2: CalculateHabEffect

    public int CalculateHabEffect(Hex habitat, Critter critter)
    {
        float climate = habitat.GetClimateVal();
        float temp = habitat.GetTempVal();
        float critterClimateFocus = critter.GetClimateFocus();
        float critterClimatePref = critter.GetClimatePref();
        float critterClimateRange = critter.GetClimateRange();
        float critterTempFocus = critter.GetTempFocus();
        float critterTempPref = critter.GetTempPref();
        float critterTempRange = critter.GetTempRange();
        Hex.BiomeType biome = habitat.GetBiomeType();
        Hex.Geography geo = habitat.GetGeography();
        int score = 0;

        //Calculates for all boon fields to create a positive score for a good habitat fit.
        foreach(BiomeAdaptition item in BiomeBoons){
            if((Hex.BiomeType)(item) == biome){
                score++;
            }
        }
        foreach(statSliderChange item in ClimateBoons){
            score += CheckStatSliderVal(item, critterClimatePref, critterClimateRange, critterClimateFocus, climate, 1);

            if (item == statSliderChange.FOCUS) { critterClimateFocus++; }
            else if (item == statSliderChange.PREF) { critterClimatePref++; }
            else if (item == statSliderChange.RANGE) { critterClimateRange++; }
        }
        foreach(GeoAdaptation item in GeoBoons){
            if((Hex.Geography)(item) == geo){
                score++;
            }
        }
        foreach(statSliderChange item in TempBoons){
            score += CheckStatSliderVal(item, critterTempPref, critterTempRange, critterTempFocus, temp, 1);

            if (item == statSliderChange.FOCUS) { critterTempFocus++; }
            else if (item == statSliderChange.PREF) { critterTempPref++; }
            else if (item == statSliderChange.RANGE) { critterTempRange++; }
        }

        //Calculates for all bane fields to create a negative score for a bad habitat fit.
        foreach(BiomeAdaptition item in BiomeBanes){
            if((Hex.BiomeType)(item) == biome){
                score--;
            }
        }
        foreach(statSliderChange item in ClimateBanes){
            score += CheckStatSliderVal(item, critterClimatePref, critterClimateRange, critterClimateFocus, climate, -1);

            if (item == statSliderChange.FOCUS) { critterClimateFocus--; }
            else if (item == statSliderChange.PREF) { critterClimatePref--; }
            else if (item == statSliderChange.RANGE) { critterClimateRange--; }
        }
        foreach(GeoAdaptation item in GeoBanes){
            if((Hex.Geography)(item) == geo){
                score--;
            }
        }
        foreach(statSliderChange item in TempBanes){
            score += CheckStatSliderVal(item, critterTempPref, critterTempRange, critterTempFocus, temp, -1);

            if (item == statSliderChange.FOCUS) { critterTempFocus--; }
            else if (item == statSliderChange.PREF) { critterTempPref--; }
            else if (item == statSliderChange.RANGE) { critterTempRange--; }
        }

        return score;
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:68,代码来源:Adaptation.cs

示例3: UpdatePanel

    private void UpdatePanel()
    {
        if(MapController.hexSelected){
            targetHex = MapController.hexSelected.GetComponent<Hex>();

            Hex.Biome hexBiome = targetHex.GetBiome();
            Hex.BiomeType hexbiomeType = targetHex.GetBiomeType();
            Hex.Geography hexGeo = targetHex.GetGeography();
            Hex.Vegetation hexVeg = targetHex.GetVegetation();
            int hexClimate = (int)targetHex.GetClimateVal();
            int hexTemp = (int)targetHex.GetTempVal();

            nameElements[0].text = hexBiome.ToString();
            nameElements[2].text = hexGeo.ToString();
            nameElements[8].text = hexVeg.ToString();

            icons[0].sprite = iconControl.GetBiomeTypeIcon(hexbiomeType);
            icons[0].color = uiControl.GetBiomeTypeSpriteColor(hexbiomeType);
            icons[1].sprite = uiControl.GetGeoSprite(hexGeo);
            icons[1].color = uiControl.GetGeoSpriteColor(hexGeo);
            icons[2].color = iconControl.GetHexVegColor(hexVeg);

            if (!critter)
            {
                critter = player.GetCritter();

                if (!critter)
                {
                    critter = GameController.CritterList[0];
                }
            }

            if (critter){
                values[0] = critter.GetBiomePref((Adaptation.BiomeAdaptition)hexbiomeType);
                values[1] = critter.GetGeoPref((Adaptation.GeoAdaptation)hexGeo);
                values[2] = critter.GetTempPref(hexTemp);
                values[3] = critter.GetClimatePref(hexClimate);

                for(int i = 0; i < 4; i++){
                    Text scoreText = nameElements[(i * 2 + 1)];

                    if(values[i] > 0){
                        scoreText.color = goodScore;
                        scoreText.text = "+" + values[i].ToString() + "%";
                    }
                    else if(values[i] < 0){
                        scoreText.color = badScore;
                        scoreText.text = values[i].ToString() + "%";
                    }
                    else{
                        scoreText.color = zeroScore;
                        scoreText.text = values[i].ToString() + "%";
                    }
                }

                UpdateSliders();
            }

            if (!critter.GetIsPlayer())
            {
                critter = null;
            }
        }
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:64,代码来源:PlayerHexInfoPanel.cs


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