コード例 #1
0
        //call ONCE before your fixed update stuff, just an organizational thing
        protected override void PreUpdate()
        {
            //tick our timers
            if (!stopTimer.TickTimer())
            {
                //tick the timer
                timer.TickTimer();
            }

            //buffer the input
            newInput = data.BufferPrev(input);

            //getting the input from outside of tick, locking in input for the current tick
            //resetting the changes made by assigning the current controller state
            input = asyncInput;



            StateFrameData newState = null;

            if (newInput)
            {
                newState = data.GetCommand();
            }
            //finding a command
            if (newState == null)
            {
                newState = data.TransitionState(!timer.IsTicking(), input);
            }


            if (newState != null)
            {
                ApplyNewState(newState);
            }

            if (!stopTimer.IsTicking())
            {
                //get the velocity from the rigidbody to manipulate
                calcVelocity = rb.velocity;
                if (data.GetState().FindFrame(timer.ElapsedTime(), ref refFrame))
                {
                    ApplyStateFrame(refFrame);
                }
            }
        }
コード例 #2
0
 public bool IsActive()
 {
     return(timer.IsTicking());
 }