當前位置: 首頁>>代碼示例>>C#>>正文


C# AnimationState類代碼示例

本文整理匯總了C#中AnimationState的典型用法代碼示例。如果您正苦於以下問題:C# AnimationState類的具體用法?C# AnimationState怎麽用?C# AnimationState使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AnimationState類屬於命名空間,在下文中一共展示了AnimationState類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Start

 // Use this for initialization
 void Start()
 {
     m_RootRef = gameObject;
     m_TransformRef = new TransformCache(m_RootRef.transform);
     m_ScaleFactor = (-m_RootRef.transform.localScale.x) / m_RootRef.transform.localScale.x;
     m_State = AnimationState.Idle;
 }
開發者ID:NDark,項目名稱:crushpiec,代碼行數:8,代碼來源:TransformAnimation.cs

示例2: OnEnable

 void OnEnable()
 {
     MyAnimation = MyTransform.GetComponent<Animation>();
     MyAnimation.wrapMode = MyWarpMode;
     MyAnimationState = MyAnimation[MyAnimation.animation.clip.name];
     MyAnimationStateTime = 0.0f;
 }
開發者ID:BBJV,項目名稱:camachi,代碼行數:7,代碼來源:MyPlayAnimation.cs

示例3: Animator

 /// <summary>
 /// Constructor that specifies a starting state for the animation
 /// </summary>
 /// <param name="startingState">Only Showing or Hiding should be used</param>
 public Animator(UserControl animateControl, AnimationState startingState)
 {
     InitializeTimer();
     animatedControl = animateControl;
     state = startingState;
     tmrAnimate.Start();
 }
開發者ID:WillVandergrift,項目名稱:Carputer,代碼行數:11,代碼來源:Animator.cs

示例4: ChangeAnimationState

 public void ChangeAnimationState(AnimationState _NextState, float _DelayTime, bool _RestoreTransform = false)
 {
     if (m_NextState != _NextState) {
         m_NextState = _NextState;
         StartCoroutine(PerformChangeAnimationState(_NextState, _DelayTime, _RestoreTransform));
     }
 }
開發者ID:NDark,項目名稱:crushpiec,代碼行數:7,代碼來源:TransformAnimation.cs

示例5: Start

    // Use this for initialization
    void Start()
    {
        animation.Stop();

        // By default loop all animations
        animation.wrapMode = WrapMode.Loop;

        // Jump animation are in a higher layer:
        // Thus when a jump animation is playing it will automatically override all other animations until it is faded out.
        // This simplifies the animation script because we can just keep playing the walk / run / idle cycle without having to spcial case jumping animations.
        int jumpingLayer = 1;
        AnimationState jump = animation["jump"];
        jump.layer = jumpingLayer;
        jump.speed *= jumpAnimationSpeedModifier;
        jump.wrapMode = WrapMode.Once;

        AnimationState jumpFall = animation["jumpFall"];
        jumpFall.layer = jumpingLayer;
        jumpFall.wrapMode = WrapMode.ClampForever;

        AnimationState jumpLand = animation["jumpLand"];
        jumpLand.layer = jumpingLayer;
        jumpLand.speed *= jumpLandAnimationSpeedModifier;
        jumpLand.wrapMode = WrapMode.Once;

        //AnimationState buttStomp = animation["buttStomp"];

        run = animation["run"];
        run.speed *= runAnimationSpeedModifier;

        AnimationState walk = animation["walk"];
        walk.speed *= walkAnimationSpeedModifier;
    }
開發者ID:NemOry,項目名稱:EscapeTheNemories,代碼行數:34,代碼來源:TimothyAnimation.cs

示例6: Update

        public virtual void Update(GameTime gameTime)
        {
            //_Sprite.Update(gameTime);

            if (_AnimationState == AnimationState.Waiting)
            {
                if (_AnimationDelayCount >= _AnimationDelayInterval)
                    PreAnimation();
            }
            else if (_AnimationState == AnimationState.Animate)
            {
                StartSiblingAnimations(FireTime.AtStart);
                if (_AnimationDelayCount < _AnimationDelayInterval)
                    _AnimationDelayCount += gameTime.ElapsedGameTime.Milliseconds;
                else
                {
                    if (_AnimationCount < _AnimationInterval)
                    {
                        _AnimationCount = MathHelper.Clamp(_AnimationCount + gameTime.ElapsedGameTime.Milliseconds, 0, _AnimationInterval);
                        AnimationLogic();
                    }
                    else
                    {
                        PostAnimation();
                        _AnimationState = AnimationState.End;
                        StartSiblingAnimations(FireTime.AtEnd);
                    }
                }
            }
        }
開發者ID:Toan-Anh,項目名稱:Triple-Triad,代碼行數:30,代碼來源:SpriteAnimation_Base.cs

示例7: CrossfadeAnimation

    //    
    public void CrossfadeAnimation(AnimationState state, float fadeTime)
    {
        // ** This function is exactly like the Unity Animation.Crossfade() method
        //
        if (currentState == state)
            return;
        animationFadeTime = fadeTime;

        for (int i = 0; i < fadingStates.Count; i++) {
            if (state.name == fadingStates[i].name) {
                fadingStates.RemoveAt (i);
                if (currentState != null)
                    fadingStates.Add (currentState);
                currentState = state;
                return;
            }
        }
        //
        if (currentState != null)
            fadingStates.Add (currentState);
        //
        currentState = state;
        currentState.weight = 0;
        currentState.time = currentStateTime = 0;
        currentState.enabled = true;
        //
    }
開發者ID:VirsixInc,項目名稱:VRCubeSword,代碼行數:28,代碼來源:AnimationController.cs

示例8: Update

 void Update()
 {
     if (Input.GetButton("Fire3"))
     {
         animationState = AnimationState.Falling;
     }
     switch (animationState)
     {
         case AnimationState.NotAnimated:
             break;
         case AnimationState.Falling:
             FallDown();
             break;
         case AnimationState.LayingDown:
             float vertical = CrossPlatformInputManager.GetAxis("Vertical");
             if (vertical != 0)
             {
                 animationState = AnimationState.GettingUp;
             }
             break;
         case AnimationState.GettingUp:
             GetUp();
             break;
         default:
             break;
     }
 }
開發者ID:LeSphax,項目名稱:Only-two-options,代碼行數:27,代碼來源:Falling.cs

示例9: OnStateAnimationChange

    public void OnStateAnimationChange(AnimationState previousState, AnimationState actualState)
    {
        bool change = false;
        switch (actualState) {
            case AnimationState.WALK:
            case AnimationState.CHASE:
            case AnimationState.RUN_AWAY:
                if (settedFX) break;
                settedFX = true;
                change = true;
                break;

            default:
                if (!settedFX) break;
                settedFX = false;
                change = true;
                break;
        }

        if (change) {
            foreach (ParticleSystem system in walkingFX.GetComponentsInChildren<ParticleSystem>()) {
                ParticleSystem.EmissionModule emission = system.emission;
                emission.enabled = settedFX;
            }
        }
    }
開發者ID:MaturuturuStudios,項目名稱:Drop,代碼行數:26,代碼來源:AntParticles.cs

示例10: Start

 // Use this for initialization
 void Start()
 {
     mOctopusAnim = GetComponent<Animator>();
     mOctopusAnim.SetFloat(mBlendTree, 1.0f);
     mRandomRange = Random.Range(minAttackTime, maxAttackTime);
     mAnimState = AnimationState.Idle;
 }
開發者ID:CenzyGames,項目名稱:Save-your-date-new,代碼行數:8,代碼來源:OctopusScr.cs

示例11: Update

 // Update is called once per frame
 void Update()
 {
     if (Input.GetAxis("Horizontal")>0)
     {
         animationState=AnimationState.walkRight;
         currentIdleTime=0.0f;
         startIdleTime=true;
     }
     else if (Input.GetAxis("Horizontal")<0)
     {
         animationState=AnimationState.walkLeft;
         currentIdleTime=0.0f;
         startIdleTime=true;
     }
     else if (Input.GetAxis("Vertical")>0)
     {
         animationState=AnimationState.walkBack;
         currentIdleTime=0.0f;
         startIdleTime=true;
     }
     else if (Input.GetAxis("Vertical")<0)
     {
         animationState=AnimationState.walkFront;
         currentIdleTime=0.0f;
         startIdleTime=true;
     }
     if (startIdleTime)
     {
         UpdateToIdleAnimations();
     }
     UpdateAnimation();
 }
開發者ID:BigBearGCU,項目名稱:MazeJ4C,代碼行數:33,代碼來源:AnimatedPlayer.cs

示例12: Initialise

 protected void Initialise()
 {
     // The Animation Controller feeds on AnimationStates. You've got to assign your animations to variables so that you can call them from the controller
     //
     GetComponent<Animation>()["Attack1"].speed = 2.0f;
     GetComponent<Animation>()["Attack2"].speed = 2.0f;
     //
     //
     animationAttack1Anticipation = GetComponent<Animation>()["Attack1Anticipation"];
     animationAttack1 = GetComponent<Animation>()["Attack1"];
     //
     animationAttack2Anticipation = GetComponent<Animation>()["Attack2Anticipation"];
     animationAttack2 = GetComponent<Animation>()["Attack2"];
     animationAttack3 = GetComponent<Animation>()["WhirlwindAttack"];
     //
     animationWhirlwind = GetComponent<Animation>()["Whirlwind"];
     animationIdle = GetComponent<Animation>()["Idle"];
     animationIdle.speed = 0.4f;
     animationRespawn = GetComponent<Animation>()["Resurection"];
     animationRespawn.speed = 0.8f;
     animationAttack3.speed = 0.8f;
     //
     leftSwipe.SetTime (0.0f, 0, 1);
     rightSwipe.SetTime (0.0f, 0, 1);
     //
 }
開發者ID:VirsixInc,項目名稱:VRCubeSword,代碼行數:26,代碼來源:BladeMaster.cs

示例13: Start

 // Use this for initialization
 void Start()
 {
     lastPosition = transform.position;
     walk = animation["walk"];
     walk.enabled = true;
     walk.weight = 0;
 }
開發者ID:rainbow23,項目名稱:UnityThirdPersonTutorial,代碼行數:8,代碼來源:Walking.cs

示例14: Awake

 // Run as the scene is initializing
 void Awake()
 {
     player = GameObject.FindWithTag("Player");
     playerStart = GameObject.Find ("PlayerStart");
     door = GameObject.FindWithTag("BedroomDoor");
     cinematic = player.animation["Beginning_Cinematic"];
 }
開發者ID:shafeen,項目名稱:EECS494-FinalGame,代碼行數:8,代碼來源:InitializeBedroomScene.cs

示例15: Start

	// Use this for initialization
	void Start () {
		lat = animation[lateralClip.name];
		vert = animation[verticalClip.name];
		lat.layer = 1;
		vert.layer = 2;
		lat.speed = 0;
		vert.speed = 0;
		lat.blendMode = AnimationBlendMode.Blend;
		vert.blendMode = AnimationBlendMode.Additive;
		lat.enabled = true;
		vert.enabled = true;
		animation.Play(lat.name);
		animation.Play(vert.name);
		
		// we have to sample the frames to determine the min and max extent in each direction
		lat.time = 0;
		vert.time = 0;
		animation.Sample();
		minOffset = endpoint.position;
		lat.normalizedTime = 1;
		vert.normalizedTime = 1;
		animation.Sample();
		maxOffset = endpoint.position;
		vertMin = minOffset.y;
		minOffset.y = startpoint.position.y;
		float maxY = maxOffset.y;
		maxOffset.y = startpoint.position.y;
		latMin = Vector3.Distance(startpoint.position, minOffset);
//		float maxRange = Vector3.Distance(startpoint.position, maxOffset);
		latScale = 1.0f/(Vector3.Distance(minOffset, maxOffset)); // so time = scale * (range-min);
		vertScale = 1.0f/(maxY - vertMin);
	}
開發者ID:MedStarSiTEL,項目名稱:UnityTrauma,代碼行數:33,代碼來源:AnimatedTubing.cs


注:本文中的AnimationState類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。