Exemplo n.º 1
0
        public override IEnumerator ExecuteAction(float transitionIn, Func <float?> getTransitionOut, Action <float> setTransitionOut)
        {
            // Execute transition
            this.StopCoroutineIfExistsAndReplace
            (
                ref _enteringExiting,
                StartCoroutine(BwEnumerator.ExecuteOverTime(weight => _jumpOn.Weight = weight, _jumpOn.Weight, 1, transitionIn, smooth: false))
            );
            // Play state
            _jumpOn.Play("JumpOn", 0.2f);
            // Loop until done
            while (true)
            {
                // Wait a frame
                yield return(null);

                // Get state
                var state = _jumpOn.GetCurrentAnimatorStateInfo();
                // Check if complete
                if (state.normalizedTime * state.length >= state.length - 0.1f)
                {
                    // Stop loop
                    break;
                }
            }
            // Execute transition
            this.StopCoroutineIfExistsAndReplace
            (
                ref _enteringExiting,
                StartCoroutine(BwEnumerator.ExecuteOverTime(weight => _jumpOn.Weight = weight, _jumpOn.Weight, 0, 0.1f, smooth: false))
            );
        }
Exemplo n.º 2
0
 private IEnumerator _Enter(float transitionTime)
 {
     // Set speed
     _speed.Value = State.Speed.magnitude;
     // Set walk
     yield return(BwEnumerator.ExecuteOverTime(weight => _walk.Weight = weight, _walk.Weight, 1, transitionTime, smooth: false));
 }
Exemplo n.º 3
0
 private IEnumerator _Exit(float transitionTime)
 {
     // Set walk
     yield return(BwEnumerator.ExecuteOverTime(weight => _walk.Weight = weight, _walk.Weight, 0, transitionTime, smooth: false));
 }