public void ApplyKinematicStateOnAuthChange(ref KinematicStateWhenAuth kinematicStateWhenAuth,
                                                    AuthorityChangeReceived authChange, Rigidbody rigidbody)
        {
            switch (authChange.Authority)
            {
            case Authority.NotAuthoritative:
                kinematicStateWhenAuth = new KinematicStateWhenAuth
                {
                    KinematicWhenAuthoritative = rigidbody.isKinematic
                };
                rigidbody.isKinematic = true;
                break;

            case Authority.Authoritative:
                rigidbody.isKinematic = kinematicStateWhenAuth.KinematicWhenAuthoritative;
                break;
            }
        }
Example #2
0
            public void AddAuthorityChange(AuthorityChangeReceived authorityChange)
            {
                if (authorityChange.Authority == Authority.NotAuthoritative)
                {
                    if (authorityLostTemporary.Remove(authorityChange.EntityId) || !authorityGained.Contains(authorityChange.EntityId))
                    {
                        authorityLost.Add(authorityChange.EntityId);
                    }
                }
                else if (authorityChange.Authority == Authority.Authoritative)
                {
                    if (authorityLost.Remove(authorityChange.EntityId))
                    {
                        authorityLostTemporary.Add(authorityChange.EntityId);
                    }
                    else
                    {
                        authorityGained.Add(authorityChange.EntityId);
                    }
                }

                authorityChanges.InsertSorted(authorityChange, authorityComparer);
            }