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


C# UnityEngine.AnimatorStateInfo类代码示例

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


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

示例1: OnStateEnter

    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(animator.gameObject.GetComponent<Enemy>().indexPos == 0){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(1)").transform.position, GameObject.Find("skillSpawn(1)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy1Attack";
            }
        }

        if(animator.gameObject.GetComponent<Enemy>().indexPos == 1){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(2)").transform.position, GameObject.Find("skillSpawn(2)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy2Attack";
            }
        }

        if(animator.gameObject.GetComponent<Enemy>().indexPos == 2){
            if(animator.GetInteger("attack") == 1){
                GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(3)").transform.position, GameObject.Find("skillSpawn(3)").transform.rotation);
                EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
                EarthBend.transform.FindChild("source").gameObject.tag = "Enemy3Attack";

            }
        }
    }
开发者ID:oonyeje,项目名称:BendingTempleAssets,代码行数:28,代码来源:EarthAttack.cs

示例2: OnStateExit

 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     // In case it is not destroyed for some reason when it depends on the animation
     if (DependOnThisState && _spawnedGameObject != null) {
         Destroy(_spawnedGameObject);
     }
 }
开发者ID:SpoonmanGames,项目名称:Descend-Into-Heaven,代码行数:8,代码来源:SpawnBehaviour.cs

示例3: GetAnimatorNameHash

		public static int GetAnimatorNameHash(AnimatorStateInfo animatorStateInfo) {
			#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
			return animatorStateInfo.nameHash;
			#else
			return animatorStateInfo.fullPathHash;
			#endif
		}
开发者ID:gorco,项目名称:LaCortesiaDeEspa-a,代码行数:7,代码来源:UITools.cs

示例4: OnStateUpdate

	override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
	{
		FootPlacementData lF1 = animator.GetComponents<FootPlacementData>()[0];
		FootPlacementData lF2 = animator.GetComponents<FootPlacementData>()[1];

		//setting up first foot transition time and extra ray dist check
		if (lF1 != null)
		{
			if(stateInfo.normalizedTime  > 0.25f)
			{
				lF1.mExtraRayDistanceCheck = mIdleRayCast;
			}
			else
			{
				lF1.mExtraRayDistanceCheck = 0;
			}
		}

		//setting up second foot transition time and extra ray dist check
		if (lF2 != null)
		{
			if(stateInfo.normalizedTime  > 0.25f)
			{
				lF2.mExtraRayDistanceCheck = mIdleRayCast;
			}
			else
			{
				lF2.mExtraRayDistanceCheck = 0;
			}
		}
	}
开发者ID:Tecaa,项目名称:Configurerer,代码行数:31,代码来源:IdleUpdate.cs

示例5: UpdateAnimator

    //**********************************************************************************//
    // ANIMATOR			      															//
    // update animations at the animator controller (Mecanim)							//
    //**********************************************************************************//
    public void UpdateAnimator()
    {
        if (ragdolled)
            DisableActions();
        else
        {
            stateInfo = animator.GetCurrentAnimatorStateInfo(0);
            actions = jumpOver || stepUp || climbUp || rolling;

            RandomIdle();
            RollForwardAnimation();
            QuickTurn180Animation();
            QuickStopAnimation();
            LandHighAnimation();
            JumpOverAnimation();
            ClimbUpAnimation();
            StepUpAnimation();

            ControlLocomotion();

            animator.SetBool("Aiming", aiming);
            animator.SetBool("Crouch", crouch);
            animator.SetBool("OnGround", onGround);
            animator.SetFloat("GroundDistance", groundDistance);
            animator.SetFloat("VerticalVelocity", verticalVelocity);
        }
    }
开发者ID:noahzaozao,项目名称:Mud7_iWorld,代码行数:31,代码来源:ThirdPersonAnimator.cs

示例6: OnStateEnter

 public override void OnStateEnter(
     Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     this.animator = animator;
     GameManager.PlayerInteraction.PowerupOn += OnPlayerPowerupOn;
     GameManager.PlayerInteraction.PowerupOff += OnPlayerPowerupOff;
 }
开发者ID:rharel,项目名称:unity-pacman,代码行数:7,代码来源:GhostPowerupAnimation.cs

示例7: OnStateEnter

 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     Debug.Log("Stop");
     var rigidbody = animator.GetComponentInParent<Rigidbody>();
     store = rigidbody.constraints;
     rigidbody.constraints = RigidbodyConstraints.FreezeAll;
 }
开发者ID:bergerbo,项目名称:ggj2016,代码行数:8,代码来源:StopVelocity.cs

示例8: Update

 // Update is called once per frame
 void Update()
 {
     time += Time.deltaTime;
     info = ani.GetCurrentAnimatorStateInfo(0);
     if (audio.isPlaying == false&&motionflag == false && time > 3.0f)
     {
         if (Life > 20)
         {
             audio.clip = okok;
             audio.Play();
             ani.SetTrigger("Win");
             motionflag = true;
         }
         else
         {
             audio.clip = nooo;
             audio.Play();
             ani.SetTrigger("Lose");
             motionflag = true;
         }
     }
     if (info.IsName("WIN00") || info.IsName("LOSE00"))
     {
         if (info.normalizedTime > 1.0f&&byeflag == false && time > 5.0f)
         {
             ani.SetTrigger("bye");
             audio.clip = bye;
             audio.Play();
             byeflag = true;
         }
     }
 }
开发者ID:akihiro0105,项目名称:Fu-Fu-UnityChan,代码行数:33,代码来源:UnityChan_Control.cs

示例9: OnStateEnter

	public RomanCharState.State characterState;	// Which state to switch into on enter
	 
	 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
	override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) 
	{
		GameManager.Instance.charState.SetState(characterState);
//		RSUtil.Instance.DelayedAction (() => {
//			GameManager.Instance.charState.SetState(characterState);
//		}, 0.2f);
	}
开发者ID:pencilking2002,项目名称:TOF_Movement_Protype,代码行数:10,代码来源:SetState.cs

示例10: Update

    void Update()
    {
        _startN = 0.0f;
        _endN = 0.0f;
        _animationState = mAnimator.GetCurrentAnimatorStateInfo (0);

        SwoonNode snode = System.Array.Find (_animations, xx => _animationState.IsName (xx.clipname));
        if (snode != null)
        {
            _time = _animationState.normalizedTime - Mathf.Floor(_animationState.normalizedTime);
            float frames = (int)(_animationState.length*30);
            _startN = snode.start / frames;
            _endN = snode.end / frames;
            if (_time >= _startN && _time < _endN)
            {
                _trails.ForEach(x=>x.Emit = true);
            }
            else
            {
                _trails.ForEach(x=>x.Emit = false);
            }
        }
        else
        {
            _time = 0f;
            //_prevTime = _time;
            //_prevAnimTime = 0f;
        }
    }
开发者ID:bmjoy,项目名称:u3dutility,代码行数:29,代码来源:SwooshNew.cs

示例11: OnStateExit

    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}
    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        myBoxCollider = animator.GetComponent<PlayerController>().mySwordBoxCollider;
        myBoxCollider.enabled = false;

        animator.SetBool("Whirlwinding", false);
    }
开发者ID:Unityprojektgruppe2,项目名称:Unity-Project---Group-2-NEW,代码行数:16,代码来源:WhirlwindStopAnimationBehaviour.cs

示例12: OnStateUpdate

 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateinfo, int layerindex)
 {
     if (Player.Instance.OnGround) {
         animator.SetBool("land", false);
         animator.ResetTrigger("jump");
     }
 }
开发者ID:sircuddles,项目名称:inScope-Studios-2D-Platformer,代码行数:12,代码来源:LandBehavior.cs

示例13: OnStateUpdate

	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
	override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
		Vector3 newPos = originalPos;
		
		newPos.y = newPos.y + yOffset;
		
		animator.transform.position = newPos;
	}
开发者ID:Subsuperhuman,项目名称:Solstice,代码行数:8,代码来源:offset.cs

示例14: Update

	// Update is called once per frame
	void Update () {
		//Debug.Log(anim.GetCurrentAnimatorStateInfo(0).tagHash.ToString());

		asi = anim.GetCurrentAnimatorStateInfo (0);
		if (asi.IsName ("Still Scenes")) {
			if(!a1HasPlayed){
				audSource.PlayOneShot (a1,2f);
				a1HasPlayed = true;
			}
		}else if (asi.IsName ("Still Scene 2")) {
			if(!a2HasPlayed){
				audSource.PlayOneShot (a2,1f);
				a2HasPlayed = true;
			}
		}else if (asi.IsName ("Still Scene 3")) {
			if(!a3HasPlayed){
				audSource.PlayOneShot (a3,1f);
				a3HasPlayed = true;
			}
		}else if (asi.IsName ("Cutscene Still 4")) {
			if(!a4HasPlayed){
				audSource.PlayOneShot (a4,1f);
				a4HasPlayed = true;
			}
		}

		if ( a4HasPlayed && !audSource.isPlaying )
			SceneManager.LoadScene ( "Instructions" );
	}
开发者ID:ecaraway,项目名称:Global-Game-Jam-2016,代码行数:30,代码来源:CutsceneAudio.cs

示例15: FixedUpdate

    void FixedUpdate()
    {
        currentBaseState = animator.GetCurrentAnimatorStateInfo(0); //Indica la capa de animacion
        int currentState = currentBaseState.nameHash;
        int state = (int)states.currentState;
        animator.SetFloat("Direction",Input.GetAxis("Horizontal"));
        animator.SetFloat("Speed",Input.GetAxis("Vertical"));
        animator.SetBool("Jump",false);

        if (Input.GetAxis("Vertical") > 0.1f){
            animator.SetBool("Walk",true);
        }else{
            animator.SetBool("Walk",false);
        }

        switch (currentState){
            case idleState:
                if (Input.GetButtonDown("Jump")){
                    animator.SetBool("Jump",true);
                }
                break;
            case walkState:
                if (Input.GetButtonDown("Jump")){
                    animator.SetBool("Jump",true);
                }
                break;
            case walkbackState:
                if (Input.GetButtonDown("Jump")){
                    animator.SetBool("Jump",true);
                }
                break;
            default:
                break;
        }
    }
开发者ID:Coolpix,项目名称:Unity,代码行数:35,代码来源:TguyControllerMio.cs


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