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


C# DefenceType.ToString方法代码示例

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


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

示例1: species

    public static string species(float size, float weirdChance = 0, float dietChance = 0, 
	                             AttackType attType = AttackType.Null, DefenceType defType = DefenceType.Null,
	                             MovementType movType = MovementType.Null, Targets targets = Targets.Null, float speed = 1, int complexity = 0)
    {
        //TODO: Come up with a name-generating system.
        string result = "";
        DietType Diet;
        if(weirdChance == 0){
            weirdChance = Random.value;
        }
        if(dietChance == 0){
            dietChance = Random.value;
        }
        result += "Fish ";

        if(dietChance >= .85){
            result += DietType.Omnivore.ToString();
            Diet = DietType.Omnivore;
        }
        else if(dietChance >= .65){
            result += DietType.Carnivore.ToString();
            Diet = DietType.Carnivore;
        }
        else{
            result += DietType.Herbivore.ToString();
            Diet = DietType.Herbivore;
        }
        result += " ";

        if(weirdChance >= 0.9f){
            if(Random.value >= 0.5){
                //Debug.Log("Flounder");
                result += (Random.Range(1f, 1.7f)*size + " ");
                result += (Random.Range(0.3f, 0.6f)*size + " ");
                result += (Random.Range(1f, 1.7f)*size + " ");
            }
            else{
                //Debug.Log ("Sunfish");
                result += (Random.Range(0.3f, 0.6f)*size + " ");
                result += (Random.Range(1.6f, 4.5f)*size + " ");
                result += (Random.Range(0.8f, 1.7f)*size + " ");
            }
        }
        else{
            result += (Random.Range(0.8f, 1.2f)*size + " ");
            result += (Random.Range(0.8f, 1.2f)*size + " ");
            result += (Random.Range(0.8f, 1.2f)*size + " ");
        }

        if(attType==AttackType.Null){
            attType = determineAttack(Diet);
        }
        result += attType.ToString() + " ";

        if(defType==DefenceType.Null){
            defType = determineDefence(Diet);
        }
        result += defType.ToString() + " ";

        if(movType==MovementType.Null){
            movType = determineMovement();
        }
        result += movType.ToString() + " ";

        if(targets==Targets.Null){
            targets = determineTargets(size, Diet, attType);
        }
        result += targets.ToString() + " ";

        //TODO:Generate Speed
        result += (speed);
        result += addMods(complexity);
        return result;
    }
开发者ID:Krosantos,项目名称:Ocean,代码行数:74,代码来源:GenUtil.cs


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