本文整理汇总了C#中UMAData类的典型用法代码示例。如果您正苦于以下问题:C# UMAData类的具体用法?C# UMAData怎么用?C# UMAData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UMAData类属于命名空间,在下文中一共展示了UMAData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GenerateUMA
void GenerateUMA()
{
GameObject myUMA = new GameObject("MyUMA");
avatar = myUMA.AddComponent<UMADynamicAvatar>();
avatar.Initialize();
umaData = avatar.umaData;
avatar.umaGenerator = generator;
umaData.umaGenerator = generator;
umaData.umaRecipe = new UMAData.UMARecipe();
umaData.umaRecipe.slotDataList = new SlotData[NUM_SLOTS];
umaDna = new UMADnaHumanoid();
umaTutorialDna = new UMADnaTutorial();
umaData.umaRecipe.AddDna(umaDna);
umaData.umaRecipe.AddDna(umaTutorialDna);
CreateMale();
avatar.animationController = animController;
avatar.UpdateNewRace();
myUMA.transform.parent = this.gameObject.transform;
myUMA.transform.localPosition = Vector3.zero;
myUMA.transform.localRotation = Quaternion.identity;
}
开发者ID:SawyerHood,项目名称:KinectUMAPrototype,代码行数:30,代码来源:UMAMaker.cs
示例2: OnDnaApplied
public void OnDnaApplied(UMAData umaData)
{
var umaDna = umaData.GetDna<UMADnaHumanoid>();
if (umaDna == null)
{
Debug.LogError("Failed to add Capsule Collider to: " + umaData.name);
return;
}
var rigid = umaData.gameObject.GetComponent<Rigidbody>();
if (rigid == null)
{
rigid = umaData.gameObject.AddComponent<Rigidbody>();
}
rigid.constraints = RigidbodyConstraints.FreezeRotation;
rigid.mass = umaData.characterMass;
var capsule = umaData.gameObject.GetComponent<CapsuleCollider>();
if (capsule == null)
{
capsule = umaData.gameObject.AddComponent<CapsuleCollider>();
}
capsule.radius = umaData.characterRadius;
capsule.height = umaData.characterHeight;
capsule.center = new Vector3(0, capsule.height * 0.5f - 0.04f, 0);
}
开发者ID:NotYours180,项目名称:UMA,代码行数:26,代码来源:CapsuleColliderSlotScript.cs
示例3: EnsureUMADataSetup
protected void EnsureUMADataSetup(UMAData umaData)
{
if (umaData.umaRoot == null)
{
GameObject newRoot = new GameObject("Root");
newRoot.transform.parent = umaData.transform;
newRoot.transform.localPosition = Vector3.zero;
newRoot.transform.localRotation = Quaternion.Euler(270f, 0, 0f);
umaData.umaRoot = newRoot;
GameObject newGlobal = new GameObject("Global");
newGlobal.transform.parent = newRoot.transform;
newGlobal.transform.localPosition = Vector3.zero;
newGlobal.transform.localRotation = Quaternion.Euler(90f, 90f, 0f);
umaData.skeleton = new UMASkeleton(newGlobal.transform);
var newRenderer = umaData.umaRoot.AddComponent<SkinnedMeshRenderer>();
newRenderer.rootBone = newGlobal.transform;
umaData.myRenderer = newRenderer;
umaData.myRenderer.enabled = false;
umaData.myRenderer.sharedMesh = new Mesh();
}
else
{
umaData.CleanMesh(false);
}
}
开发者ID:NotYours180,项目名称:UMA,代码行数:28,代码来源:UMADefaultMeshCombiner.cs
示例4: Initialize
public void Initialize()
{
blinkDelay = Random.Range(minBlinkDelay, maxBlinkDelay);
if (umaData == null)
{
// Find the UMAData, which could be up or down the hierarchy
umaData = gameObject.GetComponentInChildren<UMAData>();
if (umaData == null)
{
#if UNITY_4_3
umaData = transform.root.GetComponentInChildren<UMAData>();
#else
umaData = gameObject.GetComponentInParent<UMAData>();
#endif
}
if (umaData == null)
{
Debug.LogError("Couldn't locate UMAData component");
}
}
if ((expressionSet != null) && (umaData != null) && (umaData.skeleton != null))
{
if (umaData.animator != null)
{
Transform jaw = umaData.animator.GetBoneTransform(HumanBodyBones.Jaw);
if (jaw != null)
jawHash = UMAUtils.StringToHash(jaw.name);
}
initialized = true;
}
}
开发者ID:CaptainScience,项目名称:UMA,代码行数:33,代码来源:UMAExpressionPlayer.cs
示例5: RandomizeDNA
/// <summary>
/// Uniformly randomizes each value in the DNA.
/// </summary>
/// <param name="data">UMA data.</param>
public void RandomizeDNA(UMAData data)
{
if (dnaConverter == null)
return;
UMADnaBase dna = data.GetDna(dnaConverter.DNAType);
if (dna == null)
return;
int entryCount = dna.Count;
if (means.Length != entryCount)
{
Debug.LogWarning("Range settings out of sync with DNA, cannot apply!");
return;
}
if ((values == null) || (values.Length != entryCount))
values = new float[entryCount];
for (int i = 0; i < entryCount; i++)
{
values[i] = means[i] + (Random.value - 0.5f) * spreads[i];
}
dna.Values = values;
}
开发者ID:NotYours180,项目名称:UMA,代码行数:30,代码来源:DNARangeAsset.cs
示例6: addDirtyUMA
/// <inheritdoc/>
public override void addDirtyUMA(UMAData umaToAdd)
{
if (umaToAdd)
{
umaDirtyList.Add(umaToAdd);
}
}
开发者ID:petesimard,项目名称:UMA,代码行数:8,代码来源:UMAGeneratorBuiltin.cs
示例7: HandleDirtyUpdate
public virtual bool HandleDirtyUpdate(UMAData data)
{
if (data == null)
return true;
if (umaData != data)
{
umaData = data;
if (!umaData.Validate())
return true;
if (meshCombiner != null)
{
meshCombiner.Preprocess(umaData);
}
umaData.FireCharacterBegunEvents();
}
if (umaData.isTextureDirty)
{
if (activeGeneratorCoroutine == null)
{
activeGeneratorCoroutine = umaGeneratorCoroutine;
TextureProcessBaseCoroutine textureProcessCoroutine;
textureProcessCoroutine = new TextureProcessPROCoroutine();
textureProcessCoroutine.Prepare(data, this);
activeGeneratorCoroutine.Prepare(this, umaData, textureProcessCoroutine, !umaData.isMeshDirty);
}
bool workDone = umaGeneratorCoroutine.Work();
if (workDone)
{
activeGeneratorCoroutine = null;
umaData.isTextureDirty = false;
umaData.isAtlasDirty = true;
}
if (!workDone || !fastGeneration || umaData.isMeshDirty)
return false;
}
if (umaData.isMeshDirty)
{
UpdateUMAMesh(umaData.isAtlasDirty);
umaData.isAtlasDirty = false;
umaData.isMeshDirty = false;
if (!fastGeneration)
return false;
}
if (umaData.isShapeDirty)
{
UpdateUMABody(umaData);
umaData.isShapeDirty = false;
}
UMAReady();
return true;
}
开发者ID:petesimard,项目名称:UMA,代码行数:60,代码来源:UMAGeneratorBuiltin.cs
示例8: RandomizeDNAGaussian
/// <summary>
/// Randomizes each value in the DNA using a Gaussian distribution.
/// </summary>
/// <param name="data">UMA data.</param>
public void RandomizeDNAGaussian(UMAData data)
{
if (dnaConverter == null)
return;
UMADnaBase dna = data.GetDna(dnaConverter.DNAType);
if (dna == null)
return;
int entryCount = dna.Count;
if (means.Length != entryCount)
{
Debug.LogWarning("Range settings out of sync with DNA, cannot apply!");
return;
}
if (values == null)
values = new float[entryCount];
for (int i = 0; i < entryCount; i++)
{
values[i] = UMAUtils.GaussianRandom(means[i], deviations[i]);
}
dna.Values = values;
}
开发者ID:NotYours180,项目名称:UMA,代码行数:30,代码来源:DNARangeAsset.cs
示例9: OnDnaApplied
public void OnDnaApplied(UMAData umaData)
{
if (!hashesFound)
{
leftHandHash = UMAUtils.StringToHash("LeftHand");
rightHandHash = UMAUtils.StringToHash("RightHand");
leftTwistHash = UMAUtils.StringToHash("LeftForeArmTwist");
rightTwistHash = UMAUtils.StringToHash("RightForeArmTwist");
hashesFound = true;
}
GameObject leftHand = umaData.GetBoneGameObject(leftHandHash);
GameObject rightHand = umaData.GetBoneGameObject(rightHandHash);
GameObject leftTwist = umaData.GetBoneGameObject(leftTwistHash);
GameObject rightTwist = umaData.GetBoneGameObject(rightTwistHash);
if ((leftHand == null) || (rightHand == null) || (leftTwist == null) || (rightTwist == null))
{
Debug.LogError("Failed to add Forearm Twist to: " + umaData.name);
return;
}
var twist = umaData.umaRoot.AddComponent<TwistBones>();
twist.twistValue = 0.5f;
twist.twistBone = new Transform[] {leftTwist.transform, rightTwist.transform};
twist.refBone = new Transform[] {leftHand.transform, rightHand.transform};
}
开发者ID:NotYours180,项目名称:UMA,代码行数:27,代码来源:ForearmTwistSlotScript.cs
示例10: characterCreated
public void characterCreated(UMAData umaCreated)
{
head = umaCreated.GetBoneGameObject("Head");
MoveCamera();
player = gameObject.GetComponentInChildren<UMAExpressionPlayer>();
if (player == null)
{
Animator umaAnimator = GetComponentInChildren<Animator>();
if (umaAnimator != null)
{
player = umaAnimator.gameObject.AddComponent<UMAExpressionPlayer>();
player.overrideMecanimNeck = true;
player.overrideMecanimHead = true;
player.overrideMecanimJaw = true;
player.overrideMecanimEyes = true;
}
#if !UNITY_4_3
umaAnimator.Rebind();
#endif
}
if (player != null)
{
if (expressionSet != null)
{
player.expressionSet = expressionSet;
}
player.Initialize();
guiValues = new float[UMAExpressionPlayer.PoseCount];
}
}
开发者ID:NotYours180,项目名称:UMA,代码行数:35,代码来源:SliderExpressionTest.cs
示例11: Initialize
public void Initialize()
{
if (context == null)
{
context = UMAContext.FindInstance();
}
if (umaData == null)
{
umaData = GetComponent<UMAData>();
if (umaData == null)
{
umaData = gameObject.AddComponent<UMAData>();
if (umaGenerator != null && !umaGenerator.gameObject.activeInHierarchy)
{
Debug.LogError("Invalid UMA Generator on Avatar.", gameObject);
Debug.LogError("UMA generators must be active scene objects!", umaGenerator.gameObject);
umaGenerator = null;
}
}
}
if (umaGenerator != null)
{
umaData.umaGenerator = umaGenerator;
}
if (CharacterCreated != null) umaData.CharacterCreated = CharacterCreated;
if (CharacterDestroyed != null) umaData.CharacterDestroyed = CharacterDestroyed;
if (CharacterUpdated != null) umaData.CharacterUpdated = CharacterUpdated;
}
开发者ID:NotYours180,项目名称:UMA,代码行数:29,代码来源:UMAAvatarBase.cs
示例12: CreateAvatar
public static Avatar CreateAvatar(UMAData umaData, UmaTPose umaTPose)
{
umaTPose.DeSerialize();
HumanDescription description = CreateHumanDescription(umaData, umaTPose);
//DebugLogHumanAvatar(umaData.umaRoot, description);
Avatar res = AvatarBuilder.BuildHumanAvatar(umaData.umaRoot, description);
return res;
}
开发者ID:RapsFan,项目名称:UMA,代码行数:8,代码来源:UMAGeneratorBase.cs
示例13: SetupModule
public void SetupModule(UMAData.MaterialFragment source, int textureType)
{
textureMergeRects[textureMergeRectCount].rect = source.atlasRegion;
textureMergeRects[textureMergeRectCount].rect.y = height - textureMergeRects[textureMergeRectCount].rect.y - textureMergeRects[textureMergeRectCount].rect.height;
atlasRect = textureMergeRects[textureMergeRectCount].rect;
SetupMaterial(ref textureMergeRects[textureMergeRectCount], source, textureType);
textureMergeRectCount++;
}
开发者ID:NotYours180,项目名称:UMA,代码行数:8,代码来源:TextureMerge.cs
示例14: OnCharacterBegun
public void OnCharacterBegun(UMAData umaData)
{
var expressionPlayer = umaData.GetComponent<UMAExpressionPlayer>();
if (expressionPlayer != null)
{
expressionPlayer.SlotUpdateVsCharacterUpdate++;
}
}
开发者ID:NotYours180,项目名称:UMA,代码行数:8,代码来源:ExpressionSlotScript.cs
示例15: SetupMaterial
private void SetupMaterial(ref TextureMergeRect textureMergeRect, UMAData.MaterialFragment source, int textureType)
{
textureMergeRect.tex = source.baseTexture[textureType];
textureMergeRect.mat.shader = (textureType == 1)? normalShader : diffuseShader;
textureMergeRect.mat.SetTexture("_MainTex", source.baseTexture[textureType]);
textureMergeRect.mat.SetTexture("_ExtraTex", source.baseTexture[0]);
textureMergeRect.mat.SetColor("_Color", source.GetMultiplier(0, textureType));
textureMergeRect.mat.SetColor("_AdditiveColor", source.GetAdditive(0, textureType));
}
开发者ID:NotYours180,项目名称:UMA,代码行数:9,代码来源:TextureMerge.cs
示例16: UpdateTutorialBones
/// <summary>
/// Apply the DNA information about eye spacing to a skeleton.
/// </summary>
/// <param name="umaData">The character data.</param>
/// <param name="skeleton">Skeleton.</param>
public static void UpdateTutorialBones(UMAData umaData, UMASkeleton skeleton)
{
var umaDna = umaData.GetDna<UMADnaTutorial>();
float spacing = (umaDna.eyeSpacing - 0.5f) * 0.01f;
skeleton.SetPositionRelative(UMAUtils.StringToHash("LeftEye"), new Vector3(0f, -spacing, 0f));
skeleton.SetPositionRelative(UMAUtils.StringToHash("RightEye"), new Vector3(0f, spacing, 0f));
}
开发者ID:NotYours180,项目名称:UMA,代码行数:14,代码来源:TutorialDNAConverterBehaviour.cs
示例17: HandleDirtyUpdate
public virtual bool HandleDirtyUpdate(UMAData data)
{
umaData = data;
if (umaData.isMeshDirty)
{
if (!umaData.isTextureDirty)
{
UpdateUMAMesh(false);
}
umaData.isMeshDirty = false;
}
if (umaData.isTextureDirty)
{
if( activeGeneratorCoroutine == null )
{
activeGeneratorCoroutine = umaGeneratorCoroutine;
TextureProcessBaseCoroutine textureProcessCoroutine;
if (usePRO)
{
textureProcessCoroutine = new TextureProcessPROCoroutine();
textureProcessCoroutine.Prepare(data, this);
}
else
{
textureProcessCoroutine = new TextureProcessIndieCoroutine();
}
activeGeneratorCoroutine.Prepare(this, umaData, textureProcessCoroutine);
}
if (umaGeneratorCoroutine.Work())
{
activeGeneratorCoroutine = null;
UpdateUMAMesh(true);
umaData.isTextureDirty = false;
}
else
{
return false;
}
}
else if (umaData.isShapeDirty)
{
UpdateUMABody(umaData);
umaData.isShapeDirty = false;
UMAReady();
return true;
}
else
{
UMAReady();
return true;
}
return false;
}
开发者ID:jlu3389,项目名称:UMA,代码行数:56,代码来源:UMAGenerator.cs
示例18: UpdateUMAMesh
public override void UpdateUMAMesh(bool updatedAtlas, UMAData umaData, string[] textureNameList, int atlasResolution)
{
this.umaData = umaData;
this.textureNameList = textureNameList;
this.atlasResolution = atlasResolution;
combinedMeshList = new List<SkinnedMeshCombiner.CombineInstance>();
combinedMaterialList = new List<Material>();
if (updatedAtlas)
{
CombineByShader();
}
else
{
CombineByMaterial();
}
if (umaData.firstBake)
{
umaData.myRenderer.sharedMesh = new Mesh();
}
else
{
umaData.cleanMesh(false);
}
var boneMap = new Dictionary<Transform, Transform>();
SkinnedMeshCombiner.CombineMeshes(umaData.myRenderer, combinedMeshList.ToArray(), boneMap);
if (updatedAtlas)
{
RecalculateUV();
}
umaData.umaRecipe.ClearDNAConverters();
for (int i = 0; i < umaData.umaRecipe.slotDataList.Length; i++)
{
SlotData slotData = umaData.umaRecipe.slotDataList[i];
if (slotData != null)
{
umaData.EnsureBoneData(slotData.umaBoneData, slotData.animatedBones, boneMap);
umaData.umaRecipe.AddDNAUpdater(slotData.slotDNA);
}
}
umaData.myRenderer.quality = SkinQuality.Bone4;
//umaData.myRenderer.useLightProbes = true;
umaData.myRenderer.sharedMaterials = combinedMaterialList.ToArray();
//umaData.myRenderer.sharedMesh.RecalculateBounds();
umaData.myRenderer.sharedMesh.name = "UMAMesh";
umaData.firstBake = false;
}
开发者ID:CStudios15,项目名称:UMA,代码行数:56,代码来源:UMADefaultMeshCombiner.cs
示例19: addDirtyUMA
public override void addDirtyUMA(UMAData umaToAdd)
{
if (!gameObject.activeInHierarchy)
{
Debug.LogError("Adding Dirty UMA to a Generator that is not an active scene object, UMA generators must be active scene objects!", gameObject);
Debug.LogError("UMA Data ", umaToAdd.gameObject);
return;
}
base.addDirtyUMA(umaToAdd);
}
开发者ID:NotYours180,项目名称:UMA,代码行数:10,代码来源:UMAGenerator.cs
示例20: CharacterCreatedCallback
void CharacterCreatedCallback(UMAData umaData)
{
if (hideWhileGenerating)
{
if (umaData.animator != null)
umaData.animator.enabled = false;
if (umaData.myRenderer != null)
umaData.myRenderer.enabled = false;
}
}
开发者ID:NotYours180,项目名称:UMA,代码行数:10,代码来源:UMARecipeCrowd.cs
注:本文中的UMAData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论