예제 #1
0
        /// <summary>
        /// Takes into account:
        /// Static body (zero priority for static),
        /// ResponsibilityForUpdate by client (zero priority for not responsible),
        /// otherwise returns OwnerReplicable priority.
        /// </summary>
        protected float GetBasicPhysicsPriority(MyClientStateBase client)
        {
            // Called only on server
            if (Entity.Physics.IsStatic)
            {
                return(0);
            }

            // TODO: Rewrite and move 'ResponsibleForUpdate' to this class (when on trunk)
            var sync = (MySyncEntity)Entity.SyncObject;

            if (sync.ResponsibleForUpdate(client.GetClient()))
            {
                return(0);
            }

            return(OwnerReplicable.GetPriority(client));
        }
예제 #2
0
        public static MyPlayer GetPlayer(this MyClientStateBase state)
        {
            MyNetworkClient client = state.GetClient();

            return(client?.FirstPlayer);
        }