當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。