Scripts
ServerUserCommand.cs
using System.Collections.Generic;
///
/// This clast is used in the server only, when a player sends input to the server
/// the server wraps the input with this clast, it stores the receive Time of the commands
/// with is then used when applying them in the simulation throught the ticks.
///
public clast ServerUserCommand
{
public Player player;
public float serverRecTime;
public InputEvent ie;
public ServerUserCommand(Player player, float serverRecTime, InputEvent ie)
{
this.player = player;
this.serverRecTime = serverRecTime;
this.ie = ie;
}
public static List CreaetUserCommands(Player player, ClientInput ci)
{
List ret = new List();
float currTime = StopWacthTime.Time;
foreach (InputEvent ie in ci.inputEvents)
{
ret.Add(new ServerUserCommand(player, currTime + ie.deltaTime, ie));
}
return ret;
}
}