Beispiel #1
0
        private void SubscribeTwoNeighbors(Vector3Int neighborPos, bool subscribe)
        {
            World world = chunk.world;

            if (world == null)
            {
                return;
            }

            // No chunk lookup if the neighbor positions can't be contained in the world
            //if (!world.CheckInsideWorld(neighborPos))
            //return;

            Chunk neighbor = world.chunks.Get(ref neighborPos);

            if (neighbor == null)
            {
                return;
            }

            ChunkStateManagerClient stateManager = neighbor.stateManager;

            // Subscribe with each other. Passing Idle as event - it is ignored in this case anyway
            stateManager.Subscribe(this, ChunkState.Idle, subscribe);
            Subscribe(stateManager, ChunkState.Idle, subscribe);

            // Update required listener count of the neighbor
            UpdateListenersCount(stateManager);
        }
        private void SubscribeTwoNeighbors(Vector3Int neighborPos, bool subscribe)
        {
            Chunk neighbor = chunk.world.chunks.Get(neighborPos);

            if (neighbor != null)
            {
                ChunkStateManagerClient stateManager = (ChunkStateManagerClient)neighbor.stateManager;
                // Subscribe with each other. Passing Idle as event - it is ignored in this case anyway
                stateManager.Subscribe(this, ChunkState.Idle, subscribe);
                Subscribe(stateManager, ChunkState.Idle, subscribe);
            }
        }