コード例 #1
0
        public void OnDrawRuntimeGizmos(RuntimeGizmoDrawer drawer)
        {
            if (!drawDebug || !this.enabled || !this.gameObject.activeInHierarchy)
            {
                return;
            }

            drawer.PushMatrix();

            drawer.matrix = Matrix4x4.TRS(this.transform.position, this.transform.rotation, this.transform.lossyScale);

            foreach (var gridPoint in new GridPointEnumerator(gridSize, numRows, numCols))
            {
                drawer.DrawPosition(gridPoint.centerPos);
            }

            drawer.matrix = Matrix4x4.TRS(
                this.transform.position,
                this.transform.rotation,
                this.transform.lossyScale.CompMul(new Vector3(1f, 1f, 0.005f)));

            drawer.color = Color.red;
            drawer.DrawWireCube(Vector3.zero, gridSize);
            drawer.color = Color.green;
            drawer.DrawWireCube(Vector3.zero, gridSize - Vector2.one * 0.001f);
            drawer.color = Color.blue;
            drawer.DrawWireCube(Vector3.zero, gridSize - Vector2.one * 0.002f);

            drawer.PopMatrix();
        }