本文整理汇总了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;
}