NetworkClient - moved NotifyAuthority and 2 related others down below Reset

This commit is contained in:
MrGadget1024 2023-01-02 12:13:59 -05:00
parent d71c9e2a77
commit c0e047b01a

View File

@ -776,56 +776,6 @@ internal void OnStopLocalPlayer()
}
}
bool hadAuthority;
internal void NotifyAuthority()
{
if (!hadAuthority && isOwned)
OnStartAuthority();
if (hadAuthority && !isOwned)
OnStopAuthority();
hadAuthority = isOwned;
}
internal void OnStartAuthority()
{
foreach (NetworkBehaviour comp in NetworkBehaviours)
{
// an exception in OnStartAuthority should be caught, so that one
// component's exception doesn't stop all other components from
// being initialized
// => this is what Unity does for Start() etc. too.
// one exception doesn't stop all the other Start() calls!
try
{
comp.OnStartAuthority();
}
catch (Exception e)
{
Debug.LogException(e, comp);
}
}
}
internal void OnStopAuthority()
{
foreach (NetworkBehaviour comp in NetworkBehaviours)
{
// an exception in OnStopAuthority should be caught, so that one
// component's exception doesn't stop all other components from
// being initialized
// => this is what Unity does for Start() etc. too.
// one exception doesn't stop all the other Start() calls!
try
{
comp.OnStopAuthority();
}
catch (Exception e)
{
Debug.LogException(e, comp);
}
}
}
// build dirty mask for server owner & observers (= all dirty components).
// faster to do it in one iteration instead of iterating separately.
(ulong, ulong) ServerDirtyMasks(bool initialState)
@ -1320,6 +1270,56 @@ internal void Reset()
isLocalPlayer = false;
}
bool hadAuthority;
internal void NotifyAuthority()
{
if (!hadAuthority && isOwned)
OnStartAuthority();
if (hadAuthority && !isOwned)
OnStopAuthority();
hadAuthority = isOwned;
}
internal void OnStartAuthority()
{
foreach (NetworkBehaviour comp in NetworkBehaviours)
{
// an exception in OnStartAuthority should be caught, so that one
// component's exception doesn't stop all other components from
// being initialized
// => this is what Unity does for Start() etc. too.
// one exception doesn't stop all the other Start() calls!
try
{
comp.OnStartAuthority();
}
catch (Exception e)
{
Debug.LogException(e, comp);
}
}
}
internal void OnStopAuthority()
{
foreach (NetworkBehaviour comp in NetworkBehaviours)
{
// an exception in OnStopAuthority should be caught, so that one
// component's exception doesn't stop all other components from
// being initialized
// => this is what Unity does for Start() etc. too.
// one exception doesn't stop all the other Start() calls!
try
{
comp.OnStopAuthority();
}
catch (Exception e)
{
Debug.LogException(e, comp);
}
}
}
// Called when NetworkIdentity is destroyed
internal void ClearObservers()
{