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


C# UMAData.SetRace方法代码示例

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


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

示例1: SetGeneratedUMARace

 protected virtual UMACrowdRandomSet.CrowdRaceData SetGeneratedUMARace(UMAData.UMARecipe umaRecipe)
 {
     if (randomPool != null && randomPool.Length > 0)
     {
         int randomResult = Random.Range(0, randomPool.Length);
         UMACrowdRandomSet.CrowdRaceData race = randomPool[randomResult].data;
         umaRecipe.SetRace(raceLibrary.GetRace(race.raceID));
         return race;
     }
     else
     {
         umaRecipe.SetRace(raceLibrary.GetRace("RACHumanFemale"));
         return null;
     }
 }
开发者ID:jl3287,项目名称:RealisticAvatarCreator,代码行数:15,代码来源:UMACrowd.cs

示例2: FillUMARecipe

	/// <summary>
	/// Fills in a UMA recipe with random partial fragments from the sections.
	/// </summary>
	/// <param name="umaRecipe">UMA recipe.</param>
	/// <param name="context">Context.</param>
	public void FillUMARecipe(UMAData.UMARecipe umaRecipe, UMAContext context)
	{
		if (raceData == null)
		{
			Debug.LogWarning("Race Data must be set!");
			return;
		}
		umaRecipe.SetRace(raceData);

		int sectionCount = (recipeSections == null) ? 0 : recipeSections.Length;
		for (int i = 0; i < sectionCount; i++)
		{
			RecipeSection section = recipeSections[i];
			if ((section.recipes == null) || (section.recipes.Length == 0))
				continue;

			switch (section.selectionRule)
			{
				case SelectionType.IncludeNone:
					break;
				case SelectionType.IncludeAll:
					for (int j = 0; j < section.recipes.Length; j++)
					{
						IncludeRecipe(section.recipes[j], umaRecipe, context, false);
					}
					break;
				case SelectionType.IncludeSome:
					float chance = 1f / (float)(section.recipes.Length + 1);
					for (int j = 0; j < section.recipes.Length; j++)
					{
						if (Random.value < chance)
						{
							IncludeRecipe(section.recipes[j], umaRecipe, context, false);
						}
					}
					break;
				case SelectionType.IncludeOne:
				default:
					int index = Random.Range(0, section.recipes.Length);
					IncludeRecipe(section.recipes[index], umaRecipe, context, false);
					break;
			}
		}

		for (int i = 0; i < additionalRecipes.Length; i++)
		{
			IncludeRecipe(additionalRecipes[i], umaRecipe, context, true);
		}
	}
开发者ID:NotYours180,项目名称:UMA,代码行数:54,代码来源:UMARecipeMixer.cs


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