コード例 #1
0
 public void Draw()
 {
     if (!VisibleForCamera)
     {
         return;
     }
     if (mesh == null)
     {
         Find.WorldGrid.GetTileVertices(tile, tmpVerts);
         for (int i = 0; i < tmpVerts.Count; i++)
         {
             Vector3 a = tmpVerts[i];
             tmpVerts[i] = a + a.normalized * 0.012f;
         }
         mesh      = new Mesh();
         mesh.name = "DebugTile";
         mesh.SetVertices(tmpVerts);
         tmpIndices.Clear();
         for (int j = 0; j < tmpVerts.Count - 2; j++)
         {
             tmpIndices.Add(j + 2);
             tmpIndices.Add(j + 1);
             tmpIndices.Add(0);
         }
         mesh.SetTriangles(tmpIndices, 0);
     }
     Graphics.DrawMesh(material: (!(customMat != null)) ? WorldDebugMatsSpectrum.Mat(Mathf.RoundToInt(colorPct * 100f) % 100) : customMat, mesh: mesh, position: Vector3.zero, rotation: Quaternion.identity, layer: WorldCameraManager.WorldLayer);
 }
コード例 #2
0
ファイル: DebugTile.cs プロジェクト: wensincai/RW-Decompile
        public void Draw()
        {
            if (!this.VisibleForCamera)
            {
                return;
            }
            if (this.mesh == null)
            {
                Find.WorldGrid.GetTileVertices(this.tile, DebugTile.tmpVerts);
                for (int i = 0; i < DebugTile.tmpVerts.Count; i++)
                {
                    Vector3 a = DebugTile.tmpVerts[i];
                    DebugTile.tmpVerts[i] = a + a.normalized * 0.012f;
                }
                this.mesh      = new Mesh();
                this.mesh.name = "DebugTile";
                this.mesh.SetVertices(DebugTile.tmpVerts);
                DebugTile.tmpIndices.Clear();
                for (int j = 0; j < DebugTile.tmpVerts.Count - 2; j++)
                {
                    DebugTile.tmpIndices.Add(j + 2);
                    DebugTile.tmpIndices.Add(j + 1);
                    DebugTile.tmpIndices.Add(0);
                }
                this.mesh.SetTriangles(DebugTile.tmpIndices, 0);
            }
            Material material;

            if (this.customMat != null)
            {
                material = this.customMat;
            }
            else
            {
                int num = Mathf.RoundToInt(this.colorPct * 100f);
                num     %= 100;
                material = WorldDebugMatsSpectrum.Mat(num);
            }
            Graphics.DrawMesh(this.mesh, Vector3.zero, Quaternion.identity, material, WorldCameraManager.WorldLayer);
        }