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


C# AnimatorStateInfo.IsName方法代码示例

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


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

示例1: 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

示例2: OnStateUpdate

    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        base.OnStateUpdate(animator, stateInfo, layerIndex);

        if (Input.GetKeyDown(KeyCode.K))
        {
            if (stateInfo.IsName("PowerAttack.powerattack_1") && stateInfo.normalizedTime > 0.35f)
            {
                animator.CrossFade("powerattack_2", 0);
            }

            else if (stateInfo.IsName("PowerAttack.powerattack_2") && stateInfo.normalizedTime > 0.35f)
            {
                animator.CrossFade("powerattack_3", 0);
            }

            else if (stateInfo.IsName("PowerAttack.powerattack_3") && stateInfo.normalizedTime > 0.35f)
            {
                animator.CrossFade("powerattack_4", 0);
            }

            else if (stateInfo.IsName("PowerAttack.powerattack_4") && stateInfo.normalizedTime > 0.35f)
            {
                animator.CrossFade("powerattack_5", 0);
            }
        }
    }
开发者ID:showwho,项目名称:myFramework_UGUI,代码行数:27,代码来源:PowerAttackState.cs

示例3: Update

    // Update is called once per frame
    void Update()
    {
        tempo+=Time.deltaTime;

        if(animator)
        {
            animaState = animator.GetCurrentAnimatorStateInfo(0);
            if(animaState.IsName("padrao")){
                if(tempo>TEMPO_DE_PISCAR )
                {
                    piscarAgora();
                }
            }else if(animaState.IsName("cair")){
                material.mainTextureOffset = new Vector3(3*deslocamento,0);
            }else if(animaState.IsName("dano1")){
                tempo = TEMPO_DE_PISCAR;
                piscarAgora();
            }else
                material.mainTextureOffset = new Vector3(0,0);
        }else
        {
            animator = GetComponent<Animator>();
            if(animator)
                animaState = animator.GetCurrentAnimatorStateInfo(0);
        }
    }
开发者ID:fayvit,项目名称:PQP,代码行数:27,代码来源:piscar.cs

示例4: 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

示例5: Update

	void Update () 
	{
		currentBaseState = anim.GetCurrentAnimatorStateInfo(0);
		currentShieldState = anim.GetCurrentAnimatorStateInfo(1);

		// Check if size change has been activated by the user
		if (character.sizeChangeTransition)
		{
			ActivateSizeChangeAura();
		}
		else if (!character.sizeChangeTransition)
		{
			DeativateSizeChangeAura();
		}

		// Check if character is holding shield
		if (currentShieldState.IsName("HoldShield") || currentBaseState.IsName("Dash"))
		{
			ActivateShieldWave();
		}
		else if (!currentShieldState.IsName("HoldShield") || !currentBaseState.IsName("Dash"))
		{
			DeactivateShieldWave();
		}

		// Check if character is dashing
		if (currentBaseState.IsName("Dash"))
		{
			ActivateDashEffect();
		}

	
	}
开发者ID:zeroxiii,项目名称:CS6457_CS4455_Quicksilver_Project,代码行数:33,代码来源:RobotParticleManager.cs

示例6: OnIdle

    public override void OnIdle()
    {
        animatorController.setRuning(false);

        if (inAttack)
        {
            // 战斗待机
        }
        else
        {
            // 处于Base Layer

            // 普通待机
            baseLayerStateInfo = animator.GetCurrentAnimatorStateInfo(0);
            if (baseLayerStateInfo.IsName("Stand") && baseLayerStateInfo.normalizedTime > 0.9)
            {
                //this.animator.SetInteger("idleType", 1);
                animatorController.setIdleType(1);
            }
            else if (baseLayerStateInfo.IsName("IDLE1") && baseLayerStateInfo.normalizedTime > 0.9)
            {
                //this.animator.SetInteger("idleType", 0);
                animatorController.setIdleType(0);
            }
        }
    }
开发者ID:289997171,项目名称:vicking,代码行数:26,代码来源:PlayerMoveAnimationController.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) {
		if (stateInfo.IsName ("noop") || stateInfo.IsName ("blackout")) {
			fading = false;
		} else {
			fading = true;
		}
		animator.SetBool ("fading",fading);
	}
开发者ID:shoK0613,项目名称:snowProjForUnity,代码行数:9,代码来源:fadeAnimMan.cs

示例8: 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 (stateInfo.IsName("rotToFaceIdle") == true){
            GameObject.Find("Root").GetComponent<AnimLineControl>().RunSostav();
        }

        if (stateInfo.IsName("idleUpCan") == true){
            GameObject.Find("Root").GetComponent<AnimLineControl>().CanUpped();
        }
    }
开发者ID:Dotby,项目名称:CocaColaHealth,代码行数:11,代码来源:CanBeh.cs

示例9: 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 (stateInfo.IsName ("On")) {

        }

        if (stateInfo.IsName ("Off")) {

        }
    }
开发者ID:gmuGADIG,项目名称:Lurk2015,代码行数:11,代码来源:flammable_light_switch.cs

示例10: PlayerRayController

    void PlayerRayController()
    {
        myASI = PlayerAnimator.GetCurrentAnimatorStateInfo(0);

        Vector3 posPlayer;
        Vector3 posPlayerDown;

        posPlayer = PlayerRay.transform.position;
        posPlayer.y += 1.5f;

        posPlayerDown = posPlayer;

        RayPlayer = new Ray (posPlayer, PlayerRay.forward);
        PlayerRayDown = new Ray(posPlayerDown, -PlayerRay.up);

        Debug.DrawRay(posPlayer, PlayerRay.forward * 2, Color.red);
        Debug.DrawRay(posPlayerDown, -PlayerRay.up * 2, Color.green);

        if (bIsGrounded && myASI.IsName("Locomotion") && !myASI.IsName("JumpUp"))
        {
            if (Physics.Raycast(RayPlayer, out hitInfo, 1.5f))
            {
                Debug.Log("Choque para subir con : " + hitInfo.transform.tag);
                if (hitInfo.transform.tag.Equals("Barda") && bIsGrounded)
                {
                    bIsGrounded = false;
                    PlayerAnimator.SetTrigger("JumpToWall");
                }
            }
        }

        else if (!bIsGrounded && !myASI.IsName("JumpDownRoll") && !myASI.IsName("JumpUp") && !myASI.IsName("Locomotion"))
        {
            if (!Physics.Raycast(PlayerRayDown, out hitInfo, 1.5f))
            {
                PlayerAnimator.SetTrigger("JumpDown");
                bIsGrounded = true;
            }
        }

        /// Podemos manipular los huesos para la animacion, sólo en modelos humanoides
        /// y sólo para las manos y pies, en el resto de las partes del cuerpo no funcionan.
        ///

        ///Modificamos el tamaño del collider dependiendo del estado de la aninmacion
        if (myASI.IsName("Dive"))
            PlayerCollider.height = PlayerAnimator.GetFloat("ScaleOffsetCapsule");
        else
            PlayerCollider.height = startHeightCollider;
    }
开发者ID:salvadorlemus,项目名称:GoogleAnalytics,代码行数:50,代码来源:RayCastAnimationController.cs

示例11: OnStateEnter

	/// <summary>
	/// Method called by unity when a state is entered
	/// </summary>
	/// <param name="animator">the animator where the script is called</param>
	/// <param name="stateInfo">state info of the new state</param>
	/// <param name="layerIndex">the layer of the state change</param>
	public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
	{
		if (stateInfo.IsName("Menu_Delete"))
		{
			Destroy(animator.transform.parent.gameObject);
		}
	}
开发者ID:dallinnguyen,项目名称:Pokemon,代码行数:13,代码来源:AnimatorController.cs

示例12: UpdateAnimatorStates

 void UpdateAnimatorStates()
 {
     animatorState = m_animator.GetCurrentAnimatorStateInfo(0);
     if(animatorState.IsName("Base Layer.idle"))
     {
         if(m_animator.GetInteger("anmvlue")==0)
         {
             int radom=Random.Range(1,11);
             if(radomValue != radom){
                 radomValue=radom;
                 m_animator.SetInteger("anmvlue",radomValue);
             }
         }
     }
     else if(m_animator.GetInteger("anmvlue")!=0)
     {
         if(m_animator.GetInteger("anmvlue")==10){
             Voices[8].Play();
         }
         else{
             Voices[((radomValue-1)%8)].Play();
         }
         m_animator.SetInteger("anmvlue",0);
     }
 }
开发者ID:yupassion,项目名称:Cinderella,代码行数:25,代码来源:FemaleAnimator.cs

示例13: Update

	// Update is called once per frame
	void Update () {
		if (Grounded && playEff) {
			playEff = false;
			if (GroundEff != null)
				StartCoroutine (endEff (0.85f));
		}
		stateInfo = anim.GetCurrentAnimatorStateInfo (0);
		if (player != null && stateInfo.IsName ("idle")) {
			if (player.position.x > gameObject.transform.position.x && !facingRight) {
				// ... flip the player.翻轉人物(向右)讓facingRight = true
				Flip ();
				facingRight = true;
			}else if (player.position.x < gameObject.transform.position.x && facingRight) {
				// ... flip the player.翻轉人物使其向左 讓facingRight = fales
				Flip ();
				facingRight = false;
			}
		}

		if (needAtk && CanAtk) {
			anim.SetTrigger("Atk");
			atkCooldown = Random.Range(3,atkRate);
		}

		//anim.SetBool ("riceGround", Grounded);

		if (atkCooldown > 0) {
			atkCooldown -= Time.deltaTime;
		}
	}
开发者ID:OsDim,项目名称:ProjectROC,代码行数:31,代码来源:TaiwanBearAI.cs

示例14: OnStateExit

 void OnStateExit(AnimatorStateInfo info)
 {
     if (info.IsName(ExitAnimationName))
     {
         shouldRecycle = true;
     }
 }
开发者ID:Magicolo,项目名称:BulgareBalte,代码行数:7,代码来源:RecycleOnAnimatorState.cs

示例15: Update

    // Update is called once per frame
    void Update()
    {
        if(PlayerAnimator == null)
            PlayerAnimator = GetComponent<Animator>();

        ///Obtenemos el estado actual de la animacion
        myASI = PlayerAnimator.GetCurrentAnimatorStateInfo(0);

        ///Como la tecla no tiene sensibilidad me manda 1 directamente por lo que
        /// no se nota la animación de Walk y parece que pasa directo a Run
        /// Con un Joystic se soluciona
        ///Caminamos si presionamos hacia arriba
        PlayerAnimator.SetFloat("WalkForwardSpeed", Input.GetAxis("Vertical"));
        ///Caminamos a la Izq o Der
        PlayerAnimator.SetFloat("WalkDirection", Input.GetAxis("Horizontal"));

        ///Preguntamos si estamos dentro de la maquina de Locomotion
        /// Asi evitamos que haga otro comportamiento en cualquier otra animacion
        /// en este caso evitamos que salte si no esta corriendo
        if(myASI.IsName("Locomotion"))
            if (Input.GetKeyDown(KeyCode.Space))
                PlayerAnimator.SetTrigger("Jump");

        ///Saludo aplicado con mascaras
        /// las máscaras sirven para desasociar partes del modelo y hacer que ciertas
        /// partes haagan otras animaciones.
        /// Como correr dos máquinas de estado al mismo tiempo.
        /// Si por ejemplo la animacion de disparo se realiza con el avatar completamente estático
        /// y quiero disparar caminando, en vez de hacer una animacion nueva de Diaparo/camino
        /// lo que hago es hacer máscaras, de esa forma la parte superior del torso realiza la animacion de
        /// disparo y l aparte inferior realiza la animacion de caminado.
        /// De esa forma no tengo que hacer animaciones especificas para cada estado.
        if (Input.GetKeyDown(KeyCode.Q))
            PlayerAnimator.SetTrigger("Wave");
    }
开发者ID:salvadorlemus,项目名称:GoogleAnalytics,代码行数:36,代码来源:PlayerAnimationsController.cs


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