Renamed and added comment

This commit is contained in:
Chris Langsenkamp 2020-01-07 10:17:44 -05:00
parent 039cf5af22
commit 3d3436c80a

View File

@ -35,8 +35,9 @@ public enum Compression { None, Much, Lots, NoRotation }; // easily understandab
[Tooltip("Set to true if moves come from owner client, set to false if moves always come from server")] [Tooltip("Set to true if moves come from owner client, set to false if moves always come from server")]
public bool clientAuthority; public bool clientAuthority;
// is this a local player with authority over his own transform? // Is this a client with authority over this transform?
bool isLocalPlayerWithAuthority => hasAuthority && clientAuthority; // This component could be on the player object or any object that has been assigned authority to this client.
bool isClientWithAuthority => hasAuthority && clientAuthority;
// server // server
Vector3 lastPosition; Vector3 lastPosition;
@ -370,7 +371,7 @@ void Update()
{ {
// send to server if we have local authority (and aren't the server) // send to server if we have local authority (and aren't the server)
// -> only if connectionToServer has been initialized yet too // -> only if connectionToServer has been initialized yet too
if (!isServer && isLocalPlayerWithAuthority) if (!isServer && isClientWithAuthority)
{ {
// check only each 'syncInterval' // check only each 'syncInterval'
if (Time.time - lastClientSendTime >= syncInterval) if (Time.time - lastClientSendTime >= syncInterval)
@ -392,7 +393,7 @@ void Update()
// apply interpolation on client for all players // apply interpolation on client for all players
// unless this client has authority over the object. could be // unless this client has authority over the object. could be
// himself or another object that he was assigned authority over // himself or another object that he was assigned authority over
if (!isLocalPlayerWithAuthority) if (!isClientWithAuthority)
{ {
// received one yet? (initialized?) // received one yet? (initialized?)
if (goal != null) if (goal != null)