void FixedUpdate() { if (_animator != null) { // rest state. --_resetStateCounter; if (_tinyHurtTime > 0) { _tinyHurtTime -= Time.deltaTime; if (_tinyHurtTime <= 0) { _animator.SetInteger("SubState", 0); _animator.SetLayerWeight(1, 0); } } // update state machine. if (_resetStateCounter <= 0) { _animStateMachines[(int)_currentAnimStateMachine].Update(); } // loop count float animTime = _animator.GetCurrentAnimatorStateInfo(0).normalizedTime; float round = Mathf.Round(animTime); int round1 = Mathf.CeilToInt(_preAniPlayTime); int round2 = Mathf.CeilToInt(animTime); if (_actionCtrl != null && !_animator.IsInTransition(0) && (round - animTime > 0.0f && round - animTime < 0.05f || (round2 - round1 > 0 && round1 > 0)) && _resetStateCounter < 0) { _actionCtrl.AniIsOver((int)round); } _preAniPlayTime = animTime; } }