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


C# Animator.IsInTransition方法代码示例

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


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

示例1: OnStateUpdate

    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        //This is where combatanimation gets turned of after played wanted amount of time.
        //Portrett is player animation
            if (animator.name == "Portrett")
            {
                if (stateInfo.normalizedTime > 1 && !animator.IsInTransition (layerIndex))
                {
                    if (animator.GetBool ("isHappyMainCharacter") == true)
                    {
                        animator.SetBool ("isHappyMainCharacter", false);//Length 2 sec
                    }

                    if (animator.GetBool ("isAngryMainCharacter") == true)
                    {
                        animator.SetBool ("isAngryMainCharacter", false);//Length 2.45 sec
                    }
                }
            }
        //This is boss animation
            else if (animator.name == "Portrett2_boss")
            {
                if (stateInfo.normalizedTime > 2 && !animator.IsInTransition (layerIndex))
                {
                    if (animator.GetBool ("isHappyBoss") == true)
                    {
                        animator.SetBool ("isHappyBoss", false);//Length 1 sec
                    }

                    if (animator.GetBool ("isAngryBoss") == true)
                    {
                        animator.SetBool ("isAngryBoss", false);//Length 1.2 sec
                    }
                }
            }
        //This is enemy animation
            else if (animator.name == "Portrett2_marine")
            {
                if (stateInfo.normalizedTime > 2 && !animator.IsInTransition (layerIndex))
                {
                    if (animator.GetBool ("isHappyMarine") == true)
                    {
                        animator.SetBool ("isHappyMarine", false);//Length 1.2 sec
                    }

                    if (animator.GetBool ("isAngryMarine") == true)
                    {
                        animator.SetBool ("isAngryMarine", false);//Length 1.2 sec
                    }
                }
            }
    }
开发者ID:Rulfer,项目名称:Steam-Buccaneers,代码行数:52,代码来源:ChangeBool.cs

示例2: startWalking

 //prepare the animal to start walking animation
 //param: anim   - animator of the animal
 protected void startWalking(Animator anim) {
     if (anim.IsInTransition(0) && bStartMoving) {
         bMoving = true;
         bStartMoving = false;
         transform.rotation = Quaternion.LookRotation(moveVector) * transform.rotation;
     }
 }
开发者ID:skdeng,项目名称:SpaceCadets,代码行数:9,代码来源:Animal.cs

示例3: ConditionToChangeOn

 protected override bool ConditionToChangeOn(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animator.GetBool(GroundVariableName) && !animator.IsInTransition(layerIndex)) {
         return ChangeOnGround;
     } else {
         return ChangeOnAir;
     }
 }
开发者ID:SpoonmanGames,项目名称:Descend-Into-Heaven,代码行数:8,代码来源:ChangeOnAirGroundBehaviour.cs

示例4: OnStateUpdate

 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animator.IsInTransition(0))
         return;
     _player.FacingDirectionUpdate();
     if (_player.isArrived)
         _animator.SetBool("Run", false);
 }
开发者ID:Lobo-Prix,项目名称:TeraTale,代码行数:8,代码来源:PlayerRunning.cs

示例5: WaitForAnimation

    private IEnumerator WaitForAnimation(Animator animator)
    {
        do
        {
            yield return null;
        } while (animator.GetCurrentAnimatorStateInfo(0).IsName("Armature|Victory") || animator.GetCurrentAnimatorStateInfo(0).IsName("Armature|Victory0") || animator.IsInTransition(0));

        laser.SetActive(true);
    }
开发者ID:JoaoLReis,项目名称:Summer_2014_TD,代码行数:9,代码来源:RelayBehaviour.cs

示例6: OnStateUpdate

 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (animator.IsInTransition(0))
         return;
     _enemy.FacingDirectionUpdate();
     if (_enemy.mainTarget)
         _nma.destination = _enemy.mainTarget.transform.position;
     else
         animator.SetBool("Chase", false);
 }
开发者ID:Lobo-Prix,项目名称:TeraTale,代码行数:10,代码来源:EnemyChasing.cs

示例7: 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 (stateInfo.normalizedTime > 1 && !animator.IsInTransition(layerIndex)) {

            _counterWaitingTime += Time.deltaTime;

            if (_counterWaitingTime >= WaitingTime) {
                Application.LoadLevel(Application.loadedLevel);
            }
        }
    }
开发者ID:SpoonmanGames,项目名称:Descend-Into-Heaven,代码行数:16,代码来源:ProtaDiedBehaviour.cs

示例8: 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 (stateInfo.normalizedTime > WhenDestroy && !animator.IsInTransition(layerIndex)) {
         if (DependsOnSpeed) {
             if (animator.GetFloat(SpeedVariableName) == Speed) {
                 Destroy(animator.gameObject);
             }
         } else {
             Destroy(animator.gameObject);
         }
     }
 }
开发者ID:SpoonmanGames,项目名称:Descend-Into-Heaven,代码行数:17,代码来源:DestroyOnTimeBehaviour.cs

示例9: DisablePanelDeleyed

	IEnumerator DisablePanelDeleyed (Animator anim)
	{
		bool closedStateReached = false;
		bool wantToClose = true;
		while (!closedStateReached && wantToClose) {
			if (!anim.IsInTransition (0))
				closedStateReached = anim.GetCurrentAnimatorStateInfo (0).IsName ("Closed");
			
			wantToClose = !anim.GetBool (m_OpenParameterId);
			
			yield return new WaitForEndOfFrame ();
		}
		
		if (wantToClose)
			anim.gameObject.SetActive (false);
	}
开发者ID:PoH-TeamEEM,项目名称:PlaceOfHorror_EEM,代码行数:16,代码来源:PanelManager.cs

示例10: OnStateUpdate

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (stateInfo.normalizedTime > WhenApplyDelay && !animator.IsInTransition(layerIndex)) {

            if (_counterTimeTillResume >= TimeTillResume) {
                _actualSpeed += SpeedAugmentedFactor;
            } else {
                _counterTimeTillResume += Time.deltaTime;

                _actualSpeed -= SpeedDecreaseFactor;
            }

            _actualSpeed = Mathf.Clamp(_actualSpeed, DelaySpeedValue, ResumeSpeedValue);
            animator.SetFloat(SpeedVariableName, _actualSpeed);
        }
    }
开发者ID:SpoonmanGames,项目名称:Descend-Into-Heaven,代码行数:17,代码来源:ApplyDelayOnBehaviour.cs

示例11: OnStateUpdate

	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
        frameCount++;
        Debug.Log(frameCount);
        if (stateInfo.normalizedTime > 1 && !animator.IsInTransition(0))
        {
            switch (boolToStop)
            {
                case BooltoStop.Dive: PlayerData.Instance.canDive = false; break;
                case BooltoStop.Ninja: PlayerData.Instance.canNinja = false; break;
                case BooltoStop.Punch: PlayerData.Instance.canPunch = false; break;
            }
        }
        if (frameCount >= 30 && !shot && projectile != null)
        {
            GameObject go = Instantiate(projectile) as GameObject;
            go.transform.rotation = animator.transform.rotation;
            go.transform.position = animator.transform.position + animator.transform.up * 1 + animator.transform.forward * 1;
            shot = true;
        }
    }
开发者ID:coderDarren,项目名称:GGJ2016,代码行数:21,代码来源:StopBool.cs

示例12: WaitForAnimatorFinish

    public static IEnumerator WaitForAnimatorFinish(Animator animator, int layer)
    {
        while( true ) {
            yield return null;

            if( animator.IsInTransition(layer) )
                continue;

            AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(layer);

            Debug.Log("state info name is attack ? " + stateInfo.IsName("Attack"));
            Debug.Log("state info name is attack done ? " + stateInfo.IsName("Attack Done"));
            Debug.Log("state info name is idle ? " + stateInfo.IsName("Idle"));

            Debug.Log("animate state info = " + stateInfo.normalizedTime);

            if( stateInfo.normalizedTime >= 1 )
                break;
        }
    }
开发者ID:hhuwvom,项目名称:New-Coroutine,代码行数:20,代码来源:CoroutineExt.cs

示例13: DisablePanelDeleyed

    private IEnumerator DisablePanelDeleyed(Animator anim)
    {
        bool closedStateReached = false; // Closed 상태로 완전히 전이되었는가?
        bool wantToClose = true;    // 코루틴 도중에 anim 값바뀜 체크?
        while (!closedStateReached && wantToClose)
        {
            if (!anim.IsInTransition(0))
            {
                closedStateReached = anim.GetCurrentAnimatorStateInfo(0).IsName(_closedStateName);
            }

            wantToClose = !anim.GetBool(_openParameterId);

            yield return new WaitForEndOfFrame();
        }

        if (wantToClose)
        {
            anim.gameObject.SetActive(false);
        }
    }
开发者ID:namlunoy,项目名称:ARConcertUnity,代码行数:21,代码来源:UISystem.cs

示例14: OnStateUpdate

    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {        
        if (_BehaviourState == AnimationBehaviourState.INITIAL_POSE)
        {
            if (!animator.IsInTransition(0))
                animator.speed = 0;
            return;
        }
        const float INTERVAL = 0.1f;
        if (_BehaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS)
        {
            timeSinceCapture += Time.deltaTime;
            /*
            if (timeSinceCapture > INTERVAL)
            {
                timeSinceCapture = timeSinceCapture - INTERVAL;
                if (exerciseDataGenerator == null)
                    exerciseDataGenerator = GameObject.FindObjectOfType<Detector.ExerciseDataGenerator>();
                if (this.exerciseDataGenerator != null)
                    this.exerciseDataGenerator.CaptureData();
            }*/
        }

        DateTime temp = DateTime.Now;

        if ((_BehaviourState != AnimationBehaviourState.STOPPED && _BehaviourState != AnimationBehaviourState.RUNNING_DEFAULT)
    && (endRepTime == null || new TimeSpan(0, 0, (int)_RealParams.SecondsBetweenRepetitions) <= temp - endRepTime))
        {

            if (!BeginRep && (!IsInterleaved || (IsInterleaved && limb == Limb.Left)) &&
                this._BehaviourState != AnimationBehaviourState.PREPARING_WEB &&
                this._BehaviourState != AnimationBehaviourState.PREPARING_WITH_PARAMS &&
                this._BehaviourState != AnimationBehaviourState.PREPARING_DEFAULT)
            {
                OnRepetitionReallyStart();
                BeginRep = true;
            }
            if (stateInfo.normalizedTime >= 1.0f && haCambiadoDeEstado)
            {
                BeginRep = false;
                if (this._behaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS)
                {
                    OnLerpRoundTripEnd();
                    if (!IsInterleaved || (IsInterleaved && limb == Limb.Right))
                    {

                        if ((!this.IsWeb) && (!this.IsInInstruction) && (!this.IsInInstruction))
                        {

                            this.PauseAnimation();
                        }
                        // importante: el orden de llamadas es esencial para el correcto funcionamiento
                        OnRepetitionEnd();
                    }
                    if (IsInterleaved)
                    {
                        haCambiadoDeEstado = false;
                        animator.SetTrigger("ChangeLimb");
                    }
                    if(!IsInterleaved && (this.IsWeb || this.IsInInstruction) )
                    {
                        animator.Play(animator.GetCurrentAnimatorStateInfo(0).fullPathHash, 0, 0);
                    }
                    if (this._BehaviourState == AnimationBehaviourState.STOPPED)
                    {
                        endRepTime = null;
                    }
                }
                else if (this._behaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS)
                {
                    OnRepetitionEnd();
                    Stop();
                }

            }
            else
            {
                if (this._BehaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS || this._behaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS)
                {
                    if (stateInfo.normalizedTime <= 0.5f)
                    {
                        animator.speed = this._RealParams.ForwardSpeed;
                    }
                    else
                    {
                        animator.speed = this._RealParams.BackwardSpeed;
                    }
                }
            }
        }
    }
开发者ID:Tecaa,项目名称:Configurerer,代码行数:91,代码来源:FiniteBehaviour.cs

示例15: DisablePanelDeleyed

    private void DisablePanelDeleyed(Animator anim)
    {
        bool closedStateReached = false;
        bool wantToClose = true;
        if (!closedStateReached && wantToClose)
        {
            if (!anim.IsInTransition(0))
                closedStateReached = anim.GetCurrentAnimatorStateInfo(0).IsName(k_ClosedStateName);

            wantToClose = !anim.GetBool(m_OpenParameterId);
        }

        if (wantToClose)
            anim.gameObject.SetActive(false);
    }
开发者ID:TakaakiJimbo,项目名称:Race,代码行数:15,代码来源:PanelManager.cs


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