Пример #1
0
        /// <summary>
        /// Returns true if the provided connection should receive a transform update, otherwise false
        /// </summary>
        /// <param name="connection">network connection to potentially send transform update</param>
        /// <returns>True if the provided connection should receive a transform update, otherwise false</returns>
        public bool ShouldSendTransformInHierarchy(INetworkConnection connection)
        {
            if (isParentTransformReportingFlagValid)
            {
                StateSynchronizationPerformanceMonitor.Instance.IncrementEventCount(PerformanceComponentName, "ShouldSendTransformInHierarchy.UsedCache");
                return(cachedParentTransformReportingFlag);
            }

            if (BlockedConnections.Contains(connection))
            {
                StateSynchronizationPerformanceMonitor.Instance.IncrementEventCount(PerformanceComponentName, "BlockedConnection");
                return(false);
            }

            if (IsHidden)
            {
                return(false);
            }

            if (CachedParentTransform != null)
            {
                cachedParentTransformReportingFlag  = CachedParentTransform.ShouldSendTransformInHierarchy(connection);
                isParentTransformReportingFlagValid = true;
                StateSynchronizationPerformanceMonitor.Instance.IncrementEventCount(PerformanceComponentName, "ShouldSendTransformInHierarchy.LookupParent");
                return(cachedParentTransformReportingFlag);
            }
            else
            {
                return(true);
            }
        }
        /// <summary>
        /// Returns true if the provided endpoint should receive a transform update, otherwise false
        /// </summary>
        /// <param name="endpoint">network connection to potentially send transform update</param>
        /// <returns>True if the provided endpoint should receive a transform update, otherwise false</returns>
        public bool ShouldSendTransformInHierarchy(SocketEndpoint endpoint)
        {
            if (BlockedConnections.Contains(endpoint))
            {
                return(false);
            }

            if (IsHidden)
            {
                return(false);
            }

            if (CachedParentTransform != null)
            {
                return(CachedParentTransform.ShouldSendTransformInHierarchy(endpoint));
            }
            else
            {
                return(true);
            }
        }