internal void Process(float elapsed)
{
if(_tick < 1f / _frequencyValue)
return;
_tick = 0f;
if (Condition != null)
{
if (!Condition.Invoke())
return;
}
if (WaitingForServerReply)
return;
// If command is local, we just execute the command
if (Type == CommandType.Local)
{
ClientExecution(this);
}
// If command is local & server, we execute the command locally and request the command to be executed on the server. Once
// executed, the server will get back to us requesting to perform the command with a server computed value.
else if (Type == CommandType.LocalAndServer)
{
NetworkValue = ClientExecution(this);
SessionManager.CurrentSession.ExecuteCommandOnServer(this);
}
// If command is server only, we ask the server to execute it
else
{
if (SessionManager.CurrentSession.IsHost)
{
NetworkValue = ServerExecution(this, null);
if (ApplyServerResult != null)
SessionManager.CurrentSession.ExecuteServerCommandOnClients(this);
}
}
}