Esempio n. 1
0
        public static void SceneDebug()
        {
            Debuger_K.ClearGeneric();

            float   gs  = PathFinder.gridSize;
            Vector3 add = new Vector3(gs * 0.5f, 0, gs * 0.5f);

            StringBuilder sb = new StringBuilder();

            foreach (var item in content)
            {
                sb.AppendLine(item.Value.lastUpdate.ToString());
            }

            Debuger_K.AddLabelFormat(new Vector3(startX * gs, 0, startZ * gs), "Map space {0}\nCount {1}\n{2}", mapSpace, content.Count, sb);

            for (int x = startX; x < endX + 1; x++)
            {
                Debuger_K.AddLine(new Vector3(x, 0, startZ) * gs, new Vector3(x, 0, endZ) * gs, Color.blue);
            }

            for (int z = startZ; z < endZ + 1; z++)
            {
                Debuger_K.AddLine(new Vector3(startX, 0, z) * gs, new Vector3(endX, 0, z) * gs, Color.blue);
            }

            System.Random random = new System.Random();

            for (int x = startX; x < endX; x++)
            {
                for (int z = startZ; z < endZ; z++)
                {
                    ChunkContent content;
                    TryGetChunkContent(x, z, out content);

                    Vector3 p = (new Vector3(x, 0, z) * gs) + add;

                    Debuger_K.AddLabelFormat(p, "x: {0}\nz: {1}", x, z);

                    Color color = new Color(1, 0, 0, 0.1f);
                    if (content != null && content.Count != 0)
                    {
                        color = new Color(0, 1, 0, 0.1f);
                    }

                    Debuger_K.AddTriangle(new Vector3(x, 0, z) * gs, (new Vector3(x + 1, 0, z) * gs), (new Vector3(x, 0, z + 1) * gs), color, false);
                    Debuger_K.AddTriangle(new Vector3(x + 1, 0, z + 1) * gs, (new Vector3(x + 1, 0, z) * gs), (new Vector3(x, 0, z + 1) * gs), color, false);

                    if (content != null && content.Count != 0)
                    {
                        Color cColor = new Color(random.Next(100) / 100f, random.Next(100) / 100f, random.Next(100) / 100f, 1f);
                        foreach (var item in content)
                        {
                            Debuger_K.AddBounds(item.chunkContentBounds, cColor);
                            Debuger_K.AddLine(p, item.chunkContentBounds.center, cColor);
                        }
                    }
                }
            }
        }
    private void RecivePathDelegate(Path path)
    {
#if UNITY_EDITOR
        Debuger_K.AddLabelFormat(transform.position, "owner: {0}, valid: {1}", path.owner == _agent, path.pathType);
#endif
        ExampleThings.PathToLineRenderer(_line, path, 0.2f);
    }
Esempio n. 3
0
 public void DebugByDebuger()
 {
     for (int i = 0; i < pathNodes.Count; i++)
     {
         Debuger_K.AddDot(pathNodes[i], Color.red);
         Debuger_K.AddLabelFormat(pathNodes[i], "{0} {1}", i, pathNodes[i]);
     }
     for (int i = 0; i < pathNodes.Count - 1; i++)
     {
         Debuger_K.AddLine(pathNodes[i], pathNodes[i + 1], Color.red);
     }
 }