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


C# UnityEngine.Animation类代码示例

本文整理汇总了C#中UnityEngine.Animation的典型用法代码示例。如果您正苦于以下问题:C# Animation类的具体用法?C# Animation怎么用?C# Animation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Animation类属于UnityEngine命名空间,在下文中一共展示了Animation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 protected override void Start()
 {
     completionTime = 6.9f;
     initialRotation = transform.parent.rotation.eulerAngles;
     aSource = GetComponent<AudioSource>();
     discAnimations = transform.FindChild("mdl_chestLockDisc").gameObject.GetComponent<Animation>();
 }
开发者ID:misterplatt,项目名称:Shackle-170,代码行数:7,代码来源:spt_chestListener.cs

示例2: OnStart

		/* SAT: KSP entry points */
		public override void OnStart ( StartState state )
        {
			if (state == StartState.Editor)
            {
				print ("[SCANsat] start: in editor");
				Events["editorExtend"].active = !string.IsNullOrEmpty(animationName);
            } else
            {
				print ("[SCANsat] start: live");
            }
			if (animationName != null)
            {
				Animation[] a = part.FindModelAnimators (animationName);
				if (a.Length == 0)
                {
					print ("[SCANsat] animation '" + animationName + "' not found");
                } else
                {
					print ("[SCANsat] using animation #1 out of " + a.Length.ToString () + " animations named '" + animationName + "'");
					anim = a [0];
					// maybe use this later for advanced animation...
					Transform modeltransform = part.transform.FindChild ("model");
					foreach (Transform t in modeltransform.GetComponentsInChildren<Transform>())
                    {
						//print("[SCANsat] transform " + t.name + ": " + t);
                    }
                }
            }
			print ("[SCANsat] sensorType: " + sensorType.ToString () + " fov: " + fov.ToString () + " min_alt: " + min_alt.ToString () + " max_alt: " + max_alt.ToString () + " best_alt: " + best_alt.ToString () + " power: " + power.ToString ());
        }
开发者ID:BobPalmer,项目名称:SCANsat,代码行数:31,代码来源:SCANsat.cs

示例3: Awake

		void Awake(){
			if(type==_AniType.None) return;
			
			unitCreep=gameObject.GetComponent<UnitCreep>();
			
			if(type==_AniType.Legacy){
				aniInstance=aniRootObj.GetComponent<Animation>();
				if(aniInstance!=null){
					InitAnimation();
					unitCreep.SetAnimationComponent(this);
				}
			}
			
			if(type==_AniType.Mecanim){
				if(anim==null) anim=aniRootObj.GetComponent<Animator>();
				if(anim!=null) unitCreep.SetAnimationComponent(this);
				
				AnimatorOverrideController overrideController = new AnimatorOverrideController();
				overrideController.runtimeAnimatorController = anim.runtimeAnimatorController;
				
				//overrideController["Assigned Animation Clip Name In The Controller"] = New Clip To Be Assigned;
				//overrideController["DummySpawn"] = clipSpawn!=null ? clipSpawn : null;
				overrideController["DummyMove"] = clipMove!=null ? clipMove : null;
				overrideController["DummyDestination"] = clipDestination!=null ? clipDestination : null;
				overrideController["DummyDestroyed"] = clipDead!=null ? clipDead : null;
				
				//if no spawn animation has been assigned, use move animation instead otherwise there will be an delay, bug maybe?
				AnimationClip spawn = clipSpawn!=null ? clipSpawn : clipMove;
				overrideController["DummySpawn"] = spawn!=null ? spawn : null;
				
				anim.runtimeAnimatorController = overrideController;
			}
		}
开发者ID:ahvdesign,项目名称:Tower-Defense-Q,代码行数:33,代码来源:UnitCreepAnimation.cs

示例4: AnimState

 ///////////////////////////////////////////////////////////////////////////////
 // Functions
 ///////////////////////////////////////////////////////////////////////////////
 /// <param name="_name"> 状态名,用于调试,同时作为当前状态所播放的动作名(也就是AnimationClip.name) </param>
 public AnimState(string _name, Animation _anim, State _parent = null)
     : base(_name, _parent)
 {
     anim = _anim;
     exDebug.Assert(anim != null);
     InitWrapMode(_name);
 }
开发者ID:knoxHuang,项目名称:ex2d-dev,代码行数:11,代码来源:AnimState.cs

示例5: OnStart

        public override void OnStart(PartModule.StartState state)
        {
            DragManager = part.gameObject.GetComponent<DragManager>();

            if (DragManager == null) {
                DragManager = part.gameObject.AddComponent<DragManager>();
                DragManager.SetPart(part);
            }

            anim = part.FindModelAnimators(AnimationName)[0];
            animState = anim[AnimationName];
            animState.wrapMode = WrapMode.Clamp;

            if (FixAnimLayers) {
                int i = 0;
                foreach (AnimationState s in anim)
                    s.layer = i++;
            }

            animState.normalizedSpeed = 0;
            if (engaged) {
                animState.normalizedTime = Drag / 100;
                spoilerState = ModuleLandingGear.GearStates.DEPLOYED;
            }
            else {
                animState.normalizedTime = 0;
                spoilerState = ModuleLandingGear.GearStates.RETRACTED;
            }
            anim.Play(AnimationName);
        }
开发者ID:JDPKSP,项目名称:AdvAeronautics,代码行数:30,代码来源:ModuleSpoiler.cs

示例6: AnimationWrapper

 public AnimationWrapper(Animation anim, string statename, PlayDirection direction)
     : this(direction)
 {
     this.animation = anim;
     this.animationState = anim[statename];
     this.stateName = statename;
 }
开发者ID:Kerbas-ad-astra,项目名称:ToadicusTools,代码行数:7,代码来源:AnimationWrapper.cs

示例7: Start

		// ============================================================================================================

		public void Start()
		{
			ani = GetComponent<Animation>();
			chara = GetComponent<Chara2_Base>();

			// init idle ani
			if (string.IsNullOrEmpty(idleClip)) idleClip = null; // set to null for faster if() checks
			if (idleClip != null)
			{
				ani[idleClip].speed = idlePlaySpeed;
				ani[idleClip].wrapMode = WrapMode.Loop;
				ani.Play(idleClip);
			}

			// sorted so that lower speedDetect is checked first
			movementAnimations.Sort((a, b) => { return a.maxSpeedDetect.CompareTo(b.maxSpeedDetect); });

			// init movement anis
			for (int i = 0; i < movementAnimations.Count; i++)
			{
				if (!string.IsNullOrEmpty(movementAnimations[i].clipName))
				{
					ani[movementAnimations[i].clipName].speed = movementAnimations[i].playSpeed;
					ani[movementAnimations[i].clipName].wrapMode = WrapMode.Loop;
				}
				else movementAnimations[i] = null; // set to null for faster if() checks
			}

			// init antics
			_anticsOn = (UniRPGGlobal.Instance.state != UniRPGGlobal.State.InMainMenu);
			anticsTimer = anticsWaitTimeMin;
		}
开发者ID:fvivaudo,项目名称:Rush01,代码行数:34,代码来源:Chara2_AnimCtrl.cs

示例8: Awake

 void Awake()
 {
     controller = GetComponent<CharacterController>();
     smoothCamera = GetComponentInChildren<SmoothCameraWithBumper>();
     audioSource = GetComponentInChildren<AudioSource>();
     anim = GetComponent<Animation>();
 }
开发者ID:WhiteRavensGame,项目名称:JRPGTownPrototype,代码行数:7,代码来源:SimpleController.cs

示例9: PrintAnimationStates

 public static void PrintAnimationStates(Animation animation)
 {
     foreach (AnimationState state in animation)
     {
         Debug.Log (state.name + ": Layer: " + state.layer + ", WrapMode: " + state.wrapMode.ToString () + ", BlendMode: " + state.blendMode.ToString () + ", Enabled: " + state.enabled + ", Speed: " + state.speed + ", Length: " + state.length);
     }
 }
开发者ID:Kerbas-ad-astra,项目名称:KerbalAnimationSuite,代码行数:7,代码来源:DebugUtil.cs

示例10: OnStart

 public override void OnStart()
 {
     var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
     if (currentGameObject != prevGameObject) {
         animation = currentGameObject.GetComponent<Animation>();
         prevGameObject = currentGameObject;
     }
 }
开发者ID:wishes2018,项目名称:UnityGame,代码行数:8,代码来源:Blend.cs

示例11: HasAnimation

        private bool HasAnimation()
        {
            if (_animationComponent != null)
                return true;

            _animationComponent = GetComponent<Animation>();
            return _animationComponent != null;
        }
开发者ID:vosechu,项目名称:KerbTown,代码行数:8,代码来源:MushroomCave.cs

示例12: Initiate

		private void Initiate() {
			if (componentInitiated) return;

			animator = GetComponent<Animator>();
			animation = GetComponent<Animation>();

			InitiateSolver();
			componentInitiated = true;
		}
开发者ID:fgeraci,项目名称:CS195-Core,代码行数:9,代码来源:SolverManager.cs

示例13: Awake

		void Awake() {
			myTransform = transform;
			anim = GetComponent<Animation>();
			navMeshAgent = GetComponent<NavMeshAgent>();
			if (navMeshAgent == null) {
				Debug.LogWarning(string.Format("{0}: No NavMeshAgent found on {1}. Disabling {2}.", DialogueDebug.Prefix, name, this.GetType().Name));
				enabled = false;
			}
		}
开发者ID:SHEePYTaGGeRNeP,项目名称:DialogGame,代码行数:9,代码来源:NavigateOnMouseClick.cs

示例14: Awake

 public void Awake()
 {
     playerController = GetComponent<Widget_Controller>();
     controller = GetComponent<CharacterController>();
     aSource = GetComponent<AudioSource>();
     animationState = GetComponent<Widget_Animation>();
     anim = GetComponent<Animation>();
     bodyMesh = GameObject.Find("Body").GetComponent<SkinnedMeshRenderer>();
     wheelMesh = GameObject.Find("Wheels").GetComponent<SkinnedMeshRenderer>();
 }
开发者ID:jhessin,项目名称:Widgets,代码行数:10,代码来源:Widget_Status.cs

示例15: Idle

 public void Idle()
 {
     if (!useMecanim) {
         if (thisAnimation == null) {
             thisAnimation = GetComponent<Animation>();
             thisAnimation[idleAnimationName].wrapMode = WrapMode.Loop;
         }
         thisAnimation.Play(idleAnimationName);
     }
 }
开发者ID:RyanXiang,项目名称:RhythmGame,代码行数:10,代码来源:PlayerAnimation.cs


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