void Update()
        {
            //state.Clear();

            state.Insert(InputControl.Context, IsPushingContext());
            state.Insert(InputControl.Jump, IsJumping());
            state.Insert(InputControl.Horizontal, IsHorizontalTilted());
            state.Insert(InputControl.Vertical, IsVerticalTilted());
        }
예제 #2
0
        void Update()
        {
            //state.Clear();

            state.Insert(InputControl.Context, IsPushingContext());
            state.Insert(InputControl.Jump, IsJumping());
            state.Insert(InputControl.Horizontal, IsHorizontalPressed());
            state.Insert(InputControl.Vertical, IsVerticalPressed());

            lookOrigin = Camera.main.WorldToScreenPoint(eyeCenter.position);
        }
        IEnumerator AlternateMovementsCoroutine()
        {
            while (!eyesOnly)                   //Set before starting
            //Duck
            {
                verticalAxisDegree = -1f;
                state.Insert(InputControl.Vertical, true);
                while (curTime < timePerPhase)
                {
                    curTime += Time.deltaTime;
                    yield return(null);
                }
                Reset();
                yield return(new WaitForSeconds(timePerPhase));

                //Walk left
                state.Insert(InputControl.Horizontal, true);
                while (curTime < timePerPhase)
                {
                    horizontalAxisDegree -= Time.deltaTime;
                    horizontalAxisDegree  = horizontalAxisDegree < -1f ? -1f : horizontalAxisDegree;
                    curTime += Time.deltaTime;
                    yield return(null);
                }
                Reset();
                yield return(new WaitForSeconds(timePerPhase));

                //Walk right
                state.Insert(InputControl.Horizontal, true);
                while (curTime < timePerPhase + rightSideBias)
                {
                    horizontalAxisDegree += Time.deltaTime;
                    horizontalAxisDegree  = horizontalAxisDegree > 1f ? 1f : horizontalAxisDegree;
                    curTime += Time.deltaTime;
                    yield return(null);
                }
                Reset();
                yield return(new WaitForSeconds(timePerPhase));

                // Jump
                state.Insert(InputControl.Jump, true);
                while (curTime < timePerPhase)
                {
                    curTime += Time.deltaTime;
                    yield return(null);
                }
                yield return(new WaitForSeconds(timePerPhase));

                Reset();
            }
        }