本文整理汇总了C#中UMAData.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# UMAData.GetComponent方法的具体用法?C# UMAData.GetComponent怎么用?C# UMAData.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UMAData
的用法示例。
在下文中一共展示了UMAData.GetComponent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCharacterBegun
public void OnCharacterBegun(UMAData umaData)
{
var expressionPlayer = umaData.GetComponent<UMAExpressionPlayer>();
if (expressionPlayer != null)
{
expressionPlayer.SlotUpdateVsCharacterUpdate++;
}
}
示例2: umaData_OnCharacterUpdated
void umaData_OnCharacterUpdated(UMAData umaData)
{
var expressionPlayer = umaData.GetComponent<UMAExpressionPlayer>();
if (expressionPlayer.SlotUpdateVsCharacterUpdate-- == 0)
{
Destroy(expressionPlayer);
umaData.CharacterUpdated.RemoveListener(new UnityAction<UMAData>(umaData_OnCharacterUpdated));
return;
}
}
示例3: OnDnaApplied
public void OnDnaApplied(UMAData umaData)
{
var expressionSet = umaData.umaRecipe.raceData.expressionSet;
if (expressionSet == null)
{
Debug.LogError("Couldn't add Expressions to Race: " + umaData.umaRecipe.raceData.raceName, umaData.gameObject);
return;
}
var expressionPlayer = umaData.GetComponent<UMAExpressionPlayer>();
if (expressionPlayer == null)
{
expressionPlayer = umaData.gameObject.AddComponent<UMAExpressionPlayer>();
}
expressionPlayer.expressionSet = expressionSet;
expressionPlayer.umaData = umaData;
#pragma warning disable 618
umaData.animatedBones = expressionSet.GetAnimatedBones(umaData.skeleton);
#pragma warning restore 618
}
示例4: OnDnaApplied
public void OnDnaApplied(UMAData umaData)
{
var expressionSet = umaData.umaRecipe.raceData.expressionSet;
if (expressionSet == null)
{
Debug.LogError("Couldn't add Expressions to Race: " + umaData.umaRecipe.raceData.raceName, umaData.gameObject);
return;
}
var expressionPlayer = umaData.GetComponent<UMAExpressionPlayer>();
if (expressionPlayer == null)
{
expressionPlayer = umaData.gameObject.AddComponent<UMAExpressionPlayer>();
expressionPlayer.SlotUpdateVsCharacterUpdate++;
umaData.CharacterUpdated.AddListener(new UnityAction<UMAData>(umaData_OnCharacterUpdated));
}
expressionPlayer.expressionSet = expressionSet;
expressionPlayer.umaData = umaData;
foreach (var hash in expressionSet.GetAnimatedBoneHashes())
{
umaData.skeleton.SetAnimatedBoneHierachy(hash);
}
}
示例5: OnDnaApplied
public void OnDnaApplied(UMAData umaData)
{
var locomotion = umaData.GetComponent<Locomotion>();
if (locomotion == null)
umaData.gameObject.AddComponent<Locomotion>();
}
示例6: myColliderUpdateMethod
void myColliderUpdateMethod(UMAData umaData)
{
CapsuleCollider tempCollider = umaData.GetComponent("CapsuleCollider") as CapsuleCollider;
if(tempCollider){
UMADnaHumanoid umaDna = umaData.umaRecipe.umaDna[typeof(UMADnaHumanoid)] as UMADnaHumanoid;
tempCollider.height = (umaDna.height + 0.5f)*2 + 0.1f;
tempCollider.center = new Vector3(0,tempCollider.height*0.5f - 0.04f,0);
}
}
示例7: UpdateUMABody
public virtual void UpdateUMABody(UMAData umaData)
{
if(umaData)
{
AnimationState[] snapshot = null;
if (umaData.animationController)
{
if(unityVersion >= 4.3f){
var animator = umaData.GetComponent<Animator>();
if (animator != null)
{
snapshot = new AnimationState[animator.layerCount];
for (int i = 0; i < animator.layerCount; i++)
{
var state = animator.GetCurrentAnimatorStateInfo(i);
snapshot[i].stateHash = state.nameHash;
snapshot[i].stateTime = Mathf.Max(0, state.normalizedTime - Time.deltaTime / state.length);
}
}
}
foreach (var entry in umaData.boneList)
{
entry.Value.boneTransform.localPosition = entry.Value.originalBonePosition;
entry.Value.boneTransform.localScale = entry.Value.originalBoneScale;
entry.Value.boneTransform.localRotation = entry.Value.originalBoneRotation;
}
}
umaData.ApplyDNA();
if (umaData.animationController)
{
var animator = umaData.GetComponent<Animator>();
bool applyRootMotion = false;
bool animatePhysics = false;
AnimatorCullingMode cullingMode = AnimatorCullingMode.AlwaysAnimate;
if(animator){
applyRootMotion = animator.applyRootMotion;
animatePhysics = animator.animatePhysics;
cullingMode = animator.cullingMode;
Object.DestroyImmediate(animator);
}
var oldParent = umaData.transform.parent;
umaData.transform.parent = null;
CreateAnimator(umaData.gameObject, umaData.umaRecipe.raceData.TPose, umaData.animationController,applyRootMotion,animatePhysics,cullingMode);
umaData.transform.parent = oldParent;
animator = umaData.GetComponent<Animator>();
if(unityVersion >= 4.3f){
if (snapshot != null)
{
for (int i = 0; i < animator.layerCount; i++)
{
animator.Play(snapshot[i].stateHash, i, snapshot[i].stateTime);
}
animator.Update(0);
}
}
}
}
}