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


C# Critter.GetSize方法代码示例

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


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

示例1: Activate

    public void Activate(Critter newCritter)
    {
        critter = newCritter;
        size = critter.GetSize();
        scale = .4f + (.05f * size);

        Vector3 scaleVect = new Vector3(scale, scale, 1);

        gameObject.GetComponent<RectTransform>().localScale = scaleVect;
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:10,代码来源:CritterSpriteScaler.cs

示例2: PopulateSliders

 private void PopulateSliders(Critter critter)
 {
     statSliders[0].value = critter.GetOffense();
     statSliders[1].value = critter.GetDefense();
     statSliders[2].value = critter.GetSpeed();
     statSliders[3].value = critter.GetSense();
     statSliders[4].value = critter.GetSneak();
     subStatSliders[0].value = critter.GetSize();
     subStatSliders[1].value = critter.GetBreedRate();
     subStatSliders[2].value = critter.GetEfficiency();
     subStatSliders[3].value = critter.GetMetabolism();
 }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:12,代码来源:CitterDetails.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: Hunt

    //Determines if a creature successfully kills its target, then takes care of casualties and enegery gain.
    void Hunt(Critter target, Hex habitat)
    {
        float casualties = 0;
        float bite = biteSize;
        float targetPop = target.GetLocalPopulation(habitat);
        float targetFoodValue = target.GetBaseFoodValue();
        float huntScore = ChaseScore(target) * FightScore(target) / 100;
        //print ("-----Target = Creature#" + target.number + "------------------------------------------------------------------------------------------Hunt Success Probability = " + huntScore + ".\r\n");

        //print ("This creature (#" + number + ") Hunts Creature #" + target.number + ".\r\n");
        if(target == this){
            AquireTarget(habitat);
        }
        else if (Random.Range (1, 101) <= huntScore * AptitudeCheck(target)) {
            float popRatio;

            if(bite > energy_Needed){
                bite = energy_Needed;
            }
            if(bite < 0){
                bite = 0;
            }

            casualties = (float)((bite / targetFoodValue * target.GetSize()));

            casualties = KillCount(target, casualties);

            if(casualties >= targetPop){
                casualties = targetPop / 2;
            }

            popRatio = targetPop / (float)(1.25f * GetLocalPopulation(habitat));

            if(popRatio > 1.25f){
                popRatio = 1.25f;
            }

            casualties = (casualties * popRatio);

            foodTaken += casualties * (targetFoodValue * size);

            //print (name + " + Target: " + target.name + " PopRatio " + popRatio + "\r\n");

            if(energy_Needed <= foodTaken){
                foodTaken = energy_Needed;
            }

            targetPop -= casualties;
            target.SetLocalAdultPopulation(targetPop, habitat);

            target.AddCrittersEaten(casualties);
            target.AddToHuntDeathsList(habitat, turn, casualties);

            habitat.AddExcessMeatFood(foodTaken * .5f);

            target.MortalityCheck(habitat);

            target.UpdateStats();

            //if(isPlayer){
                //print ("Total Kills = " + casualties + ". Food aquired = " + foodTaken + " vs. Energy Needed = " + energy_Needed +"\r\n");
            //}
        } //else {print ("Hunt Failed.\r\n");}
    }
开发者ID:Paulgherve1,项目名称:Critters,代码行数:65,代码来源:Critter.cs

示例5: AptitudeCheck

    private float AptitudeCheck(Critter target)
    {
        float value = 1;

        for(int i = 0; i < locomotion.Count; i++){

        }
        //if isn't flyer but target is: value *= .5f;

        //if is value *= 1.25f;

        if(diet.Contains(dietType.INSECT)){
            if(target.GetSize() > 1){
                value *= .5f;
            }
        }
        if(target.GetSize() > size){
            if(target.GetSize() > size + 1){
                value *= .5f;
            }
            else{
                value *= .75f;
            }
        }

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


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