当前位置: 首页>>代码示例>>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;未经允许,请勿转载。