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


C# Critter.GetClimatePref方法代码示例

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


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

示例1: 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

示例2: UpdateHudCounters

 private void UpdateHudCounters(Critter item)
 {
     hudItems[0].SetCounterValue(item.GetBiomePref((Adaptation.BiomeAdaptition)localType));
     hudItems[1].SetCounterValue(item.GetTempPref(tempVal));
     hudItems[2].SetCounterValue(item.GetGeoPref((Adaptation.GeoAdaptation)localGeo));
     hudItems[3].SetCounterValue(item.GetClimatePref(climateVal));
 }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:7,代码来源:Hex.cs

示例3: CloneStats

    public void CloneStats(Critter critter)
    {
        offense = critter.GetOffense();
        defense = critter.GetDefense();
        baseSpeed = critter.GetBaseSpeed();
        sense = critter.GetSense();
        sneak = critter.GetSneak();
        size = critter.GetSize();
        breedRate = critter.GetBreedRate();
        metabolism = critter.GetMetabolism();

        biomePref = critter.GetBiomePrefs();
        climateFocus = critter.GetClimateFocus();
        climatePref = critter.GetClimatePref();
        climateRange = critter.GetClimateRange();
        geoPref = critter.GetGeoPrefs();
        tempFocus = critter.GetTempFocus();
        tempPref = critter.GetTempPref();
        tempRange = critter.GetTempRange();

        evoMod = critter.GetEvoMod();
        migrateMod = critter.GetMigrateMod();
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:23,代码来源:Critter.cs

示例4: SetHandleTransform

    private void SetHandleTransform(Critter critter, state newState)
    {
        RectTransform rect = handle.GetComponent<RectTransform>();
        Vector3 handSize;
        Vector3 handPos = new Vector3(0, rect.anchoredPosition.y);
        float sliderWidth = (slider.GetComponent<RectTransform>().sizeDelta.x - 10);
        float width = 0;
        float incVal = sliderWidth / 45;

        if (newState == state.CLIMATE)
        {
            width = 1 + (critter.GetClimateRange() * incVal * 2);
            handPos = new Vector3((critter.GetClimatePref() * incVal), rect.anchoredPosition.y);
        }
        if (newState == state.TEMP)
        {
            width = 1 + (critter.GetTempRange() * incVal * 2);
            handPos = new Vector3((critter.GetTempPref() * incVal), rect.anchoredPosition.y);
        }

        handSize = new Vector3(width, rect.sizeDelta.y);

        rect.sizeDelta = handSize;
        rect.anchoredPosition = handPos;

        ClampPosition(rect, incVal);
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:27,代码来源:StatSlider.cs


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