コード例 #1
0
ファイル: VoxelPlayUI.cs プロジェクト: jisuhyun/mobileTest
        void UpdateDebugInfo()
        {
            sbDebug.Length = 0;

            if (env.playerGameObject != null)
            {
                Vector3 pos = env.playerGameObject.transform.position;
                sbDebug.Append("Player Position: X=");
                AppendValueDebug(pos.x.ToString("F2"));

                sbDebug.Append(", Y=");
                AppendValueDebug(pos.y.ToString("F2"));

                sbDebug.Append(", Z=");
                AppendValueDebug(pos.z.ToString("F2"));
            }

            VoxelChunk currentChunk = env.GetCurrentChunk();

            if (currentChunk != null)
            {
                sbDebug.AppendLine();

                sbDebug.Append("Current Chunk: X=");
                AppendValueDebug(currentChunk.position.x);

                sbDebug.Append(", Y=");
                AppendValueDebug(currentChunk.position.y);

                sbDebug.Append(", Z=");
                AppendValueDebug(currentChunk.position.z);
            }
            VoxelChunk hitChunk = env.lastHitInfo.chunk;

            if (hitChunk != null)
            {
                int voxelIndex = env.lastHitInfo.voxelIndex;

                sbDebug.AppendLine();

                sbDebug.Append("Last Chunk Hit: X=");
                AppendValueDebug(hitChunk.position.x);

                sbDebug.Append(", Y=");
                AppendValueDebug(hitChunk.position.y);

                sbDebug.Append(", Z=");
                AppendValueDebug(hitChunk.position.z);

                sbDebug.Append(", AboveTerrain=");
                AppendValueDebug(hitChunk.isAboveSurface);

                int px, py, pz;
                env.GetVoxelChunkCoordinates(voxelIndex, out px, out py, out pz);

                sbDebug.AppendLine();

                sbDebug.Append("Last Voxel Hit: X=");
                AppendValueDebug(px);

                sbDebug.Append(", Y=");
                AppendValueDebug(py);

                sbDebug.Append(", Z=");
                AppendValueDebug(pz);

                sbDebug.Append(", Index=");
                AppendValueDebug(env.lastHitInfo.voxelIndex);

                sbDebug.Append(", Light=");
                AppendValueDebug(env.lastHitInfo.voxel.lightMesh);

                if (env.lastHitInfo.voxel.typeIndex != 0)
                {
                    sbDebug.Append(", Type=");
                    AppendValueDebug(env.lastHitInfo.voxel.type.name);
                }
            }
            debugText.text = sbDebug.ToString();
        }