public void UpdateInfo(PlayerUpdate newInfo)
        {
            if (playerInfo == null)
            {
                return;
            }

            if (noInterpolation)
            {
                playerInfo.updateInfo = newInfo;
                return;
            }

            _syncStartInfo = playerInfo.updateInfo;
            if (_syncStartInfo.IsRotNaN())
            {
                _syncStartInfo.headRot      = Quaternion.identity;
                _syncStartInfo.leftHandRot  = Quaternion.identity;
                _syncStartInfo.rightHandRot = Quaternion.identity;
                _syncStartInfo.leftLegRot   = Quaternion.identity;
                _syncStartInfo.rightLegRot  = Quaternion.identity;
                _syncStartInfo.pelvisRot    = Quaternion.identity;
                Plugin.log.Warn("Start rotation is NaN!");
            }

            if (Mathf.Abs(playerInfo.updateInfo.playerProgress - newInfo.playerProgress) > 0.1f)
            {
                playerInfo.updateInfo.playerProgress = newInfo.playerProgress;
            }

            _syncEndInfo = newInfo;
            if (_syncEndInfo.IsRotNaN())
            {
                _syncEndInfo.headRot      = Quaternion.identity;
                _syncEndInfo.leftHandRot  = Quaternion.identity;
                _syncEndInfo.rightHandRot = Quaternion.identity;
                _syncEndInfo.leftLegRot   = Quaternion.identity;
                _syncEndInfo.rightLegRot  = Quaternion.identity;
                _syncEndInfo.pelvisRot    = Quaternion.identity;
                Plugin.log.Warn("Target rotation is NaN!");
            }

            syncTime  = 0;
            syncDelay = Time.time - lastSynchronizationTime;

            if (syncDelay > 0.5f)
            {
                syncDelay = 0.5f;
            }

            lastSynchronizationTime = Time.time;
        }
Exemple #2
0
        public void UpdateInfo(PlayerUpdate newInfo)
        {
            if (playerInfo == null)
            {
                return;
            }

            syncTime  = 0;
            syncDelay = Time.time - lastSynchronizationTime;

            if (syncDelay > 0.5f)
            {
                syncDelay = 0.5f;
            }

            lastSynchronizationTime = Time.time;

            if (noInterpolation)
            {
                playerInfo.updateInfo = newInfo;
                return;
            }
            else
            {
                playerInfo.updateInfo.playerNameColor = newInfo.playerNameColor;
                playerInfo.updateInfo.playerState     = newInfo.playerState;

                playerInfo.updateInfo.fullBodyTracking   = newInfo.fullBodyTracking;
                playerInfo.updateInfo.playerScore        = newInfo.playerScore;
                playerInfo.updateInfo.playerCutBlocks    = newInfo.playerCutBlocks;
                playerInfo.updateInfo.playerComboBlocks  = newInfo.playerComboBlocks;
                playerInfo.updateInfo.playerTotalBlocks  = newInfo.playerTotalBlocks;
                playerInfo.updateInfo.playerEnergy       = newInfo.playerEnergy;
                playerInfo.updateInfo.playerLevelOptions = newInfo.playerLevelOptions;
                playerInfo.updateInfo.playerFlags        = newInfo.playerFlags;
            }

            _syncStartInfo = _syncEndInfo;
            if (_syncStartInfo.IsRotNaN())
            {
                _syncStartInfo.headRot      = Quaternion.identity;
                _syncStartInfo.leftHandRot  = Quaternion.identity;
                _syncStartInfo.rightHandRot = Quaternion.identity;
                _syncStartInfo.leftLegRot   = Quaternion.identity;
                _syncStartInfo.rightLegRot  = Quaternion.identity;
                _syncStartInfo.pelvisRot    = Quaternion.identity;
                Plugin.log.Warn("Start rotation is NaN!");
            }

            if (Mathf.Abs(playerInfo.updateInfo.playerProgress - newInfo.playerProgress) > 0.1f)
            {
                playerInfo.updateInfo.playerProgress = newInfo.playerProgress;
            }

            _syncEndInfo = newInfo;
            if (_syncEndInfo.IsRotNaN())
            {
                _syncEndInfo.headRot      = Quaternion.identity;
                _syncEndInfo.leftHandRot  = Quaternion.identity;
                _syncEndInfo.rightHandRot = Quaternion.identity;
                _syncEndInfo.leftLegRot   = Quaternion.identity;
                _syncEndInfo.rightLegRot  = Quaternion.identity;
                _syncEndInfo.pelvisRot    = Quaternion.identity;
                Plugin.log.Warn("Target rotation is NaN!");
            }
        }