Пример #1
0
        void OnDrawGizmos()
        {
            if (actorInterface != null)
            {
                Bounds boundsAABB = actorInterface.GetAABB();

                if (boundsAABB.IntersectRay(HandleUtility.GUIPointToWorldRay(Event.current.mousePosition)))
                {
                    //This draws an invisible cube around the bounds at all times, so you can click on it and get it as a selection
                    if (enabled && IsVisible())
                    {
                        Gizmos.color = new Color(0.0f, 0.0f, 0.0f, 0.0f);
                        Gizmos.DrawCube(boundsAABB.center, boundsAABB.size);
                    }
                }

                if (debugDrawBounds)
                {
                    Gizmos.color = new Color(0.0f, 0.0f, 1.0f, 0.3f);
                    Gizmos.DrawCube(boundsAABB.center, boundsAABB.size);
                }

                if (debugDrawOccluder)
                {
                    Gizmos.color = new Color(0.0f, 0.8f, 0.0f, 0.5f);
                    Gizmos.DrawSphere(boundsAABB.center, Vector3.Distance(boundsAABB.center, boundsAABB.max) + occlusionRadiusOffset);
                }

                if (Selection.Contains(gameObject))
                {
                    Gizmos.color = new Color(1.0f, 1.0f, 1.0f, 0.8f);
                    Bounds b = actorInterface.GetBounds();

                    float scaleFactor = 1.0f;

                    if (hvrAsset)
                    {
                        scaleFactor = hvrAsset.assetScaleFactor;
                    }

                    b.center = b.center * scaleFactor;
                    b.size   = b.size * scaleFactor;

                    DrawBounds.Draw(b, transform);
                }
            }
        }
Пример #2
0
    void Start()
    {
        // weird indexing to skip air
        blocks = new Block[Blocks.count - 1];
        for (int i = 1; i < Blocks.count; ++i)
        {
            blocks[i - 1] = new Block((byte)i);
        }

        cam        = GetComponent <Camera>();
        flyCam     = GetComponent <FlyCam>();
        startColor = cam.backgroundColor;
        ToggleDebugDay();

        world = FindObjectOfType <World>();

        drawer = GetComponent <DrawBounds>();

        blockMeshFilter = GetComponentInChildren <MeshFilter>();
        MeshBuilder.PrimeBasicBlock();
        MeshBuilder.GetBlockMesh(blocks[blockIndex], blockMeshFilter);
    }