Beispiel #1
0
        public static void DebugDrawEntityChunks()
        {
            for (var i = 0; i < chunks_.Length; i++)
            {
                Chunk chunk = chunks_[i];

                Vector2 chunkStart = new Vector2(REGION_SIZE_IN_METERS * -2 + i * CHUNK_SIZE, 0);

                int curRegion = (i >> REGION_LOG_SIZE_IN_CHUNKS) + currentOriginInRegions;

                // color according to region
                Color c = Color.Red;
                if (curRegion == 1)
                {
                    c = Color.Lime;
                }
                else if (curRegion == 2)
                {
                    c = Color.Yellow;
                }
                else if (curRegion == 3)
                {
                    c = Color.Cyan;
                }

                DebugHelper.AddDebugText(
                    $"regn:{curRegion}\narri:{i}\ncnki:{i% REGION_SIZE_IN_CHUNKS}\nents:{chunk.entities.Count}"
                    , chunkStart + Vector2.UnitY * -6, c);

                DebugHelper.AddDebugLine(chunkStart, chunkStart + Vector2.UnitY * CHUNK_SIZE, new Color(0, 1, 0, 0.25f));

                foreach (Entity entity in chunk.entities)
                {
                    //DebugHelper.AddDebugLine(chunkStart, entity.Position, Color.Yellow);
                    //DebugHelper.AddDebugText(GetChunkForPosition(entity.Position).X.ToString(), entity.Position, c);
                }
            }
        }