mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Predicted Billiards Example: remove old 'inputs' code
This commit is contained in:
parent
83d652c7f4
commit
779da04b7f
@ -23,10 +23,6 @@ public class PlayerPredicted : NetworkBehaviour
|
|||||||
// white ball component
|
// white ball component
|
||||||
WhiteBallPredicted whiteBall;
|
WhiteBallPredicted whiteBall;
|
||||||
|
|
||||||
// keep a history of inputs with timestamp
|
|
||||||
public int inputHistorySize = 64;
|
|
||||||
readonly SortedList<double, PlayerInput> inputs = new SortedList<double, PlayerInput>();
|
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
// find the white ball once
|
// find the white ball once
|
||||||
@ -62,11 +58,6 @@ void ApplyForceToWhite(Vector3 force)
|
|||||||
// we reuse the white ball's OnMouseDrag and forward the event to here.
|
// we reuse the white ball's OnMouseDrag and forward the event to here.
|
||||||
public void OnDraggedBall(Vector3 force)
|
public void OnDraggedBall(Vector3 force)
|
||||||
{
|
{
|
||||||
// record the input for reconciliation if needed
|
|
||||||
if (inputs.Count >= inputHistorySize) inputs.RemoveAt(0);
|
|
||||||
inputs.Add(NetworkTime.time, new PlayerInput(NetworkTime.time, force));
|
|
||||||
Debug.Log($"Inputs.Count={inputs.Count}");
|
|
||||||
|
|
||||||
// apply force locally immediately
|
// apply force locally immediately
|
||||||
ApplyForceToWhite(force);
|
ApplyForceToWhite(force);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user