예제 #1
0
        private void LateUpdate()
        {
            SyncState syncState = state;

            if (syncState != SyncState.INTERPOLATION || desiredStartEvent.Timestamp == desiredTargetEvent.Timestamp)
            {
                return;
            }
            LocomotionController currentController = locomotionTracker.GetCurrentController();
            float   t      = (float)(motionSequenceStartTime + timer.ElapsedMilliseconds - desiredStartEvent.Timestamp) / (float)(desiredTargetEvent.Timestamp - desiredStartEvent.Timestamp);
            Vector3 vector = Vector3.Lerp(startPosition, desiredTargetEvent.Position, t);

            if (!Allow3DMovement)
            {
                vector.y = ((currentController != null) ? currentController.GetPosition().y : base.transform.position.y);
            }
            if (currentController != null)
            {
                currentController.RemoteSetPosition(vector);
                if (currentController is SlideController && desiredTargetEvent.Velocity.HasValue)
                {
                    Vector3 newFacing = Vector3.Slerp(startFacing, desiredTargetEvent.Velocity.Value, t);
                    currentController.RemoteSetFacing(newFacing);
                }
            }
            else
            {
                base.transform.position = vector;
            }
        }