//Remove on 2024/06/01 //using FishNet.Utility.Extension; //using System.Runtime.CompilerServices; //using UnityEngine; //namespace FishNet.Object.Prediction //{ // internal class LocalTransformTickSmoother // { // #region Private. // /// // /// Object to smooth. // /// // private Transform _transform; // /// // /// When not 0f the graphical object will teleport into it's next position if the move distance exceeds this value. // /// // private float _teleportThreshold; // /// // /// How quickly to move towards goal values. // /// // private MoveRates _moveRates; // /// // /// WOrld values of the graphical during PreTick. // /// // private TransformProperties _preTickValues; // /// // /// Local values of the graphical after PostTick. // /// // private TransformProperties? _postTickValues; // /// // /// Duration to move over. // /// // private float _tickDelta; // /// // /// True if a pretick occurred since last postTick. // /// // private bool _preTicked; // #endregion // /// // /// Initializes this smoother; should only be completed once. // /// // internal void InitializeOnce(Transform t, float teleportDistance, float tickDelta) // { // //If current graphicalObject is set then snap it to postTick values. // if (_transform != null && _postTickValues.HasValue) // _transform.SetLocalProperties(_postTickValues.Value); // _tickDelta = tickDelta; // _postTickValues = t.GetWorldProperties(); // _transform = t; // _teleportThreshold = teleportDistance; // } // /// // /// Called every frame. // /// // internal void Update() // { // if (!CanSmooth()) // return; // if (_postTickValues.HasValue) // MoveToTarget(_postTickValues.Value); // } // /// // /// Called when the TimeManager invokes OnPreTick. // /// // internal void OnPreTick() // { // if (!CanSmooth()) // return; // _preTicked = true; // _preTickValues = _transform.GetWorldProperties(); // } // /// // /// Called when TimeManager invokes OnPostTick. // /// // internal void OnPostTick() // { // if (!CanSmooth()) // return; // //If preticked then previous transform values are known. // if (_preTicked) // { // SetMoveRates(_preTickValues, _transform); // _postTickValues = _transform.GetWorldProperties(); // _transform.SetWorldProperties(_preTickValues); // } // _preTicked = false; // } // /// // /// Returns if prediction can be used on this rigidbody. // /// // /// // private bool CanSmooth() // { // if (_transform == null) // return false; // return true; // } // /// // /// Moves transform to target values. // /// // [MethodImpl(MethodImplOptions.AggressiveInlining)] // private void MoveToTarget(TransformProperties tp) // { // _moveRates.MoveLocalToTarget(_transform, tp, Time.deltaTime); // } // /// // /// Sets Position and Rotation move rates to reach Target datas. // /// // private void SetMoveRates(TransformProperties prevValues, Transform t) // { // float duration = _tickDelta; // float teleportT = _teleportThreshold; // _moveRates = MoveRates.GetWorldMoveRates(prevValues, t, duration, teleportT); // } // } //}