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


C# UMAData.GetComponent方法代码示例

本文整理汇总了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++;
			}
		}
开发者ID:NotYours180,项目名称:UMA,代码行数:8,代码来源:ExpressionSlotScript.cs

示例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;
			}
		}
开发者ID:NotYours180,项目名称:UMA,代码行数:10,代码来源:ExpressionSlotScript.cs

示例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
 }
开发者ID:BillDStrong,项目名称:UMA,代码行数:19,代码来源:ExpressionSlotScript.cs

示例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);
			}
		}
开发者ID:NotYours180,项目名称:UMA,代码行数:22,代码来源:ExpressionSlotScript.cs

示例5: OnDnaApplied

		public void OnDnaApplied(UMAData umaData)
		{
			var locomotion = umaData.GetComponent<Locomotion>();
			if (locomotion == null)
				umaData.gameObject.AddComponent<Locomotion>();
		}
开发者ID:NotYours180,项目名称:UMA,代码行数:6,代码来源:LocomotionSlotScript.cs

示例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);
     }
 }
开发者ID:Jblew,项目名称:marinesmud-3d,代码行数:9,代码来源:UMACrowd.cs

示例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);
                        }
                    }
                }
            }
        }
开发者ID:stoddy2hotty,项目名称:UMA,代码行数:61,代码来源:UMAGenerator.cs


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