Exemple #1
0
 private void OnDrawGizmos()
 {
     Gizmos.color = new Color(1, 0, 0, 0.4f);
     Gizmos.DrawCube(AttackBoxOrigin.position, AttackBoxScale * 2f);
 }
Exemple #2
0
 void OnDrawGizmos()
 {
     Gizmos.color = GizmosColor;
     Gizmos.DrawCube(transform.position, transform.localScale);
 }
 void OnDrawGizmos()
 {
     Gizmos.color = Color.white;
     Gizmos.DrawCube(transform.position, Vector3.one);
 }
 private void OnDrawGizmos()
 {
     Gizmos.color = new Color(0, 255, 255, .3f);
     Gizmos.DrawCube(transform.position, interactionRange);
 }
Exemple #5
0
 private void Update()
 {
     Gizmos.DrawCube(transform.position, boxScale);
 }
 void OnDrawGizmos()
 {
     Gizmos.color = new Color(1, 2, 0, .5f);
     Gizmos.DrawCube(_focusArea.center, focusAreaSize);
 }
Exemple #7
0
    private void GenerateFlowField()
    {
        Map map = new Map(30, 1f);


        //Generate the center pos of each cell and random obstacles
        Random.InitState(0);

        for (int z = 0; z < map.MapWidth; z++)
        {
            for (int x = 0; x < map.MapWidth; x++)
            {
                if (Random.Range(0f, 1f) < 0.1f)
                {
                    map.cellData[x, z].isObstacleInCell = true;
                }
            }
        }


        //Generate the flow field if the target is within the map
        IntVector2 ballPos = map.ConvertWorldToCell(ballTrans.position);

        if (!map.IsCellWithinGrid(ballPos))
        {
            return;
        }

        FlowFieldNode[,] flowField = GenerateFlowField(map, ballPos);


        //Display the flow field
        float[,] flowDistances = new float[map.MapWidth, map.MapWidth];

        for (int z = 0; z < map.MapWidth; z++)
        {
            for (int x = 0; x < map.MapWidth; x++)
            {
                flowDistances[x, z] = flowField[x, z].totalCostFlowField;
            }
        }



        //Find the max value to easier display a color, which is 0-1
        float max = FlowField.GetMaxDistance(flowDistances);

        for (int z = 0; z < map.MapWidth; z++)
        {
            for (int x = 0; x < map.MapWidth; x++)
            {
                Vector3 cellPos = map.cellData[x, z].centerPos;

                //Grayscale
                float grayScale = flowDistances[x, z] / max;

                //A common way to display a flow field is to use red-green
                //where green decreases and red increases with distance to the goal
                Vector3 rgb = new Vector3(grayScale, 1f - grayScale, 0f);

                //Apparently, Gizmos.color is drawing at half color intensity, so we should double to get the correct color
                //rgb *= 2f;

                Gizmos.color = new Color(rgb.x, rgb.y, rgb.z);

                //Not accessible
                if (flowDistances[x, z] == float.MaxValue)
                {
                    Gizmos.color = Color.blue;
                }
                //Obstacle
                if (map.cellData[x, z].isObstacleInCell)
                {
                    Gizmos.color = Color.black;
                }

                float gizmosCellSize = map.CellWidth * 1f;

                Gizmos.DrawCube(cellPos, new Vector3(gizmosCellSize, 0.01f, gizmosCellSize));
            }
        }



        //Display which flowfield target is the closest
        HashSet <IntVector2> flowFieldTargetCellPos = flowField[ballPos.x, ballPos.z].closestStartNodes;

        foreach (IntVector2 c in flowFieldTargetCellPos)
        {
            Vector3 flowFieldTarget = map.cellData[c.x, c.z].centerPos;

            Gizmos.color = Color.white;

            Gizmos.DrawLine(flowFieldTarget, ballTrans.position);
        }
    }
Exemple #8
0
 private void OnDrawGizmos()
 {
     Gizmos.DrawCube(new Vector3(player.transform.position.x, player.transform.position.y - player.GetComponent <NavMeshAgent>().baseOffset, player.transform.position.z), Vector3.one);
 }
    public void OnDrawGizmos()
    {
        Gizmos.matrix = transform.localToWorldMatrix;

        Gizmos.DrawCube(Vector3.zero, new Vector3(sizeX, sizeY, sizeZ));
    }
Exemple #10
0
 void OnDrawGizmos()
 {
     Gizmos.color = new Color(1, 0, 0, .5f);
     Gizmos.DrawCube(FocusArea.Centre, FocusAreaSize);
 }
Exemple #11
0
 void OnDrawGizmosSelected()
 {
     Gizmos.color = new Color(1, 0, 0, 0.5f);
     Gizmos.DrawCube(center, size);
 }
Exemple #12
0
    // Mmm should be in gizmo code
    void Display(MegaPathDeform pd)
    {
        if (pd.path != null)
        {
            // Need to do a lookat on first point to get the direction
            pd.mat = Matrix4x4.identity;

            Vector3 p = pd.path.splines[curve].knots[0].p;

            Vector3 p1 = pd.path.InterpCurve3D(curve, 0.01f, pd.path.normalizedInterp);
            Vector3 up = Vector3.zero;

            switch (axis)
            {
            case MegaAxis.X: up = Vector3.left; break;

            case MegaAxis.Y: up = Vector3.back; break;

            case MegaAxis.Z: up = Vector3.up; break;
            }

            Quaternion lrot = Quaternion.identity;

            if (flip)
            {
                up = -up;
            }

            lrot = Quaternion.FromToRotation(p1 - p, up);

            pd.mat.SetTRS(Vector3.zero, lrot, Vector3.one);

            Matrix4x4 mat = pd.transform.localToWorldMatrix * pd.mat;

            for (int s = 0; s < pd.path.splines.Count; s++)
            {
                float ldist = pd.path.stepdist * 0.1f;
                if (ldist < 0.01f)
                {
                    ldist = 0.01f;
                }

                float ds = pd.path.splines[s].length / (pd.path.splines[s].length / ldist);

                int c  = 0;
                int k  = -1;
                int lk = -1;

                Vector3 first = pd.path.splines[s].Interpolate(0.0f, pd.path.normalizedInterp, ref lk) - p;

                for (float dist = ds; dist < pd.path.splines[s].length; dist += ds)
                {
                    float   alpha = dist / pd.path.splines[s].length;
                    Vector3 pos   = pd.path.splines[s].Interpolate(alpha, pd.path.normalizedInterp, ref k) - p;

                    if ((c & 1) == 1)
                    {
                        Gizmos.color = pd.path.col1;
                    }
                    else
                    {
                        Gizmos.color = pd.path.col2;
                    }

                    if (k != lk)
                    {
                        for (lk = lk + 1; lk <= k; lk++)
                        {
                            Gizmos.DrawLine(mat.MultiplyPoint(first), mat.MultiplyPoint(pd.path.splines[s].knots[lk].p - p));
                            first = pd.path.splines[s].knots[lk].p - p;
                        }
                    }

                    lk = k;

                    Gizmos.DrawLine(mat.MultiplyPoint(first), mat.MultiplyPoint(pos));

                    c++;

                    first = pos;
                }

                if ((c & 1) == 1)
                {
                    Gizmos.color = pd.path.col1;
                }
                else
                {
                    Gizmos.color = pd.path.col2;
                }

                if (pd.path.splines[s].closed)
                {
                    Vector3 pos = pd.path.splines[s].Interpolate(0.0f, pd.path.normalizedInterp, ref k) - p;
                    Gizmos.DrawLine(mat.MultiplyPoint(first), mat.MultiplyPoint(pos));
                }
            }

            Vector3 p0 = pd.path.InterpCurve3D(curve, (percent / 100.0f), pd.path.normalizedInterp) - p;
            p1 = pd.path.InterpCurve3D(curve, (percent / 100.0f) + (tangent * 0.01f), pd.path.normalizedInterp) - p;

            Gizmos.color = Color.blue;
            Vector3 sz = new Vector3(pd.path.KnotSize * 0.01f, pd.path.KnotSize * 0.01f, pd.path.KnotSize * 0.01f);
            Gizmos.DrawCube(mat.MultiplyPoint(p0), sz);
            Gizmos.DrawCube(mat.MultiplyPoint(p1), sz);
        }
    }
 private void OnDrawGizmosSelected()
 {
     Gizmos.color = new Color(1, 0, 0, 0.5f);
     Gizmos.DrawCube(transform.localPosition, size);
 }
 public void OnDrawGizmos()
 {
     Gizmos.color = Color.red;
     Gizmos.DrawCube(transform.position, new Vector3(1, 1, 1));
 }
Exemple #15
0
 // show the gizmos in color
 void OnDrawGizmosSelected()
 {
     Gizmos.color = m_SpawnColor;
     Gizmos.DrawCube(transform.position, spawnArea);
 }
        void SetSubmesh(int submeshIndex, Spine.Unity.MeshGeneration.SubmeshInstruction submeshInstructions, ExposedList <bool> flipStates, bool isLastSubmesh)
        {
                #else
        void SetSubmesh(int submeshIndex, Spine.Unity.MeshGeneration.SubmeshInstruction submeshInstructions, bool isLastSubmesh)
        {
                #endif
            SubmeshTriangleBuffer currentSubmesh = submeshes.Items[submeshIndex];
            int[] triangles = currentSubmesh.triangles;

            int triangleCount = submeshInstructions.triangleCount;
            int firstVertex   = submeshInstructions.firstVertexIndex;

            int trianglesCapacity = triangles.Length;
            if (isLastSubmesh && trianglesCapacity > triangleCount)
            {
                // Last submesh may have more triangles than required, so zero triangles to the end.
                for (int i = triangleCount; i < trianglesCapacity; i++)
                {
                    triangles[i] = 0;
                }

                currentSubmesh.triangleCount = triangleCount;
            }
            else if (trianglesCapacity != triangleCount)
            {
                // Reallocate triangles when not the exact size needed.
                currentSubmesh.triangles     = triangles = new int[triangleCount];
                currentSubmesh.triangleCount = 0;
            }

                        #if SPINE_OPTIONAL_FRONTFACING
            if (!this.renderMeshes && !this.frontFacing)
            {
                        #else
            if (!this.renderMeshes)
            {
                        #endif
                // Use stored triangles if possible.
                if (currentSubmesh.firstVertex != firstVertex || currentSubmesh.triangleCount < triangleCount)                   //|| currentSubmesh.triangleCount == 0
                {
                    currentSubmesh.triangleCount = triangleCount;
                    currentSubmesh.firstVertex   = firstVertex;

                    for (int i = 0; i < triangleCount; i += 6, firstVertex += 4)
                    {
                        triangles[i]     = firstVertex;
                        triangles[i + 1] = firstVertex + 2;
                        triangles[i + 2] = firstVertex + 1;
                        triangles[i + 3] = firstVertex + 2;
                        triangles[i + 4] = firstVertex + 3;
                        triangles[i + 5] = firstVertex + 1;
                    }
                }
                return;
            }

            // This method caches several .Items arrays.
            // Never mutate their overlying ExposedList objects.

                        #if SPINE_OPTIONAL_FRONTFACING
            var flipStatesItems = flipStates.Items;
                        #endif

            // Iterate through all slots and store their triangles.
            var drawOrderItems = skeleton.DrawOrder.Items;
            int triangleIndex  = 0;            // Modified by loop
            for (int i = submeshInstructions.startSlot, n = submeshInstructions.endSlot; i < n; i++)
            {
                Attachment attachment = drawOrderItems[i].attachment;
                                #if SPINE_OPTIONAL_FRONTFACING
                bool flip = frontFacing && flipStatesItems[i];

                // Add RegionAttachment triangles
                if (attachment is RegionAttachment)
                {
                    if (!flip)
                    {
                        triangles[triangleIndex]     = firstVertex;
                        triangles[triangleIndex + 1] = firstVertex + 2;
                        triangles[triangleIndex + 2] = firstVertex + 1;
                        triangles[triangleIndex + 3] = firstVertex + 2;
                        triangles[triangleIndex + 4] = firstVertex + 3;
                        triangles[triangleIndex + 5] = firstVertex + 1;
                    }
                    else
                    {
                        triangles[triangleIndex]     = firstVertex + 1;
                        triangles[triangleIndex + 1] = firstVertex + 2;
                        triangles[triangleIndex + 2] = firstVertex;
                        triangles[triangleIndex + 3] = firstVertex + 1;
                        triangles[triangleIndex + 4] = firstVertex + 3;
                        triangles[triangleIndex + 5] = firstVertex + 2;
                    }

                    triangleIndex += 6;
                    firstVertex   += 4;
                    continue;
                }
                                #else
                if (attachment is RegionAttachment)
                {
                    triangles[triangleIndex]     = firstVertex;
                    triangles[triangleIndex + 1] = firstVertex + 2;
                    triangles[triangleIndex + 2] = firstVertex + 1;
                    triangles[triangleIndex + 3] = firstVertex + 2;
                    triangles[triangleIndex + 4] = firstVertex + 3;
                    triangles[triangleIndex + 5] = firstVertex + 1;

                    triangleIndex += 6;
                    firstVertex   += 4;
                    continue;
                }
                                #endif

                // Add (Weighted)MeshAttachment triangles
                int[] attachmentTriangles;
                int   attachmentVertexCount;
                var   meshAttachment = attachment as MeshAttachment;
                if (meshAttachment != null)
                {
                    attachmentVertexCount = meshAttachment.worldVerticesLength >> 1;                     // length/2
                    attachmentTriangles   = meshAttachment.triangles;
                }
                else
                {
                    continue;
                }

                                #if SPINE_OPTIONAL_FRONTFACING
                if (flip)
                {
                    for (int ii = 0, nn = attachmentTriangles.Length; ii < nn; ii += 3, triangleIndex += 3)
                    {
                        triangles[triangleIndex + 2] = firstVertex + attachmentTriangles[ii];
                        triangles[triangleIndex + 1] = firstVertex + attachmentTriangles[ii + 1];
                        triangles[triangleIndex]     = firstVertex + attachmentTriangles[ii + 2];
                    }
                }
                else
                {
                    for (int ii = 0, nn = attachmentTriangles.Length; ii < nn; ii++, triangleIndex++)
                    {
                        triangles[triangleIndex] = firstVertex + attachmentTriangles[ii];
                    }
                }
                                #else
                for (int ii = 0, nn = attachmentTriangles.Length; ii < nn; ii++, triangleIndex++)
                {
                    triangles[triangleIndex] = firstVertex + attachmentTriangles[ii];
                }
                                #endif

                firstVertex += attachmentVertexCount;
            }
        }

                #if UNITY_EDITOR
        void OnDrawGizmos()
        {
            // Make scene view selection easier by drawing a clear gizmo over the skeleton.
            meshFilter = GetComponent <MeshFilter>();
            if (meshFilter == null)
            {
                return;
            }

            Mesh mesh = meshFilter.sharedMesh;

            if (mesh == null)
            {
                return;
            }

            Bounds meshBounds = mesh.bounds;

            Gizmos.color  = Color.clear;
            Gizmos.matrix = transform.localToWorldMatrix;
            Gizmos.DrawCube(meshBounds.center, meshBounds.size);
        }
                #endif

        ///<summary>This is a Mesh that also stores the instructions SkeletonRenderer generated for it.</summary>
        public class SmartMesh {
Exemple #17
0
 private void OnDrawGizmos()
 {
     Gizmos.color = color;
     Gizmos.DrawCube(transform.position, size);
 }
Exemple #18
0
 private void OnDrawGizmos() //чтобы визуализировать область атаки
 {
     Gizmos.color = Color.red;
     Gizmos.DrawCube(attackZonePosition.position, new Vector3(attackRangeX, attackRangeY, attackRangeZ));
 }
Exemple #19
0
 //DEBUG ONLY: Draw gizmo to better visualise hinge position(s)
 void OnDrawGizmosSelected()
 {
     Gizmos.color = new Color(1, 0, 0, 0.5f); //Red (Transparent)
     Gizmos.DrawCube(transform.position, transform.localScale);
 }
Exemple #20
0
        private bool DrawAccessibility(IGrid grid, Cell start, Cell end, Color lineColor)
        {
            var matrix   = grid.cellMatrix;
            var cellSize = grid.cellSize;

            VectorXZ[] directions = new[] { new VectorXZ(-1, 0), new VectorXZ(-1, 1), new VectorXZ(0, 1), new VectorXZ(1, 1) };
            var        heightAdj  = new Vector3(0.0f, 0.05f, 0.0f);

            for (int x = start.matrixPosX; x <= end.matrixPosX; x++)
            {
                for (int z = start.matrixPosZ; z <= end.matrixPosZ; z++)
                {
                    var c = matrix[x, z];
                    if (c == null)
                    {
                        return(false);
                    }

                    if (!c.isWalkable(this.modelAttributes))
                    {
                        Gizmos.color = this.obstacleColor;
                        Gizmos.DrawCube(c.position, new Vector3(cellSize, 0.05f, cellSize));
                        continue;
                    }

                    var curPos = new VectorXZ(x, z);
                    for (int i = 0; i < 4; i++)
                    {
                        var checkPos = curPos + directions[i];
                        var other    = matrix[checkPos.x, checkPos.z];

                        if (other != null)
                        {
                            if (!other.isWalkable(this.modelAttributes))
                            {
                                continue;
                            }

                            //Determine top and bottom, with bottom winning over top if equal so to speak, due to cross height.
                            var topPos    = c;
                            var bottomPos = other;
                            if (topPos.position.y <= bottomPos.position.y)
                            {
                                topPos    = bottomPos;
                                bottomPos = c;
                            }

                            var topDown = bottomPos.isWalkableFrom(topPos, _modelProps);
                            var downTop = topPos.isWalkableFrom(bottomPos, _modelProps);

                            if (topDown && downTop)
                            {
                                Gizmos.color = lineColor;
                            }
                            else if (topDown)
                            {
                                Gizmos.color = this.descentOnlyColor;
                            }
                            else if (downTop)
                            {
                                Gizmos.color = this.ascentOnlyColor;
                            }
                            else
                            {
                                continue;
                            }

                            Gizmos.DrawLine(c.position + heightAdj, other.position + heightAdj);
                        }
                    } /* end for each selected neighbour */
                }
            }

            return(true);
        }
Exemple #21
0
    bool DrawOriginalGizmo(Transform selTrans, bool bLocal)
    {
        float   fLineLen  = NgLayout.GetWorldPerScreenPixel(FXMakerEffect.inst.m_CurrentEffectRoot.transform.position) * (Screen.width * m_fGizmoLinePerScreen * m_fWorldLineRatio);
        float   fCapSize  = fLineLen * 0.07f * m_fCapSizeRatio;
        Vector3 cubeSize  = Vector3.one * fCapSize;
        bool    bSelected = false;

        // check active
        if ((((GIZMO_TYPE)m_nGizmoTypeIndex) != GIZMO_TYPE.HAND && ((GIZMO_TYPE)m_nGizmoTypeIndex) != GIZMO_TYPE.NONE) && m_bClick == false)
        {
            AXIS  nActiveAxis    = AXIS.NONE;
            float fStartClickLen = fLineLen / 4.0f;

            if (HandleUtility.DistanceToLine(GetPosition(selTrans) + GetDirect(selTrans, AXIS.X, bLocal) * fStartClickLen, GetPosition(selTrans) + GetDirect(selTrans, AXIS.X, bLocal) * fLineLen) < m_fActiveDist)
            {
                nActiveAxis = AXIS.X;
            }
            if (HandleUtility.DistanceToLine(GetPosition(selTrans) + GetDirect(selTrans, AXIS.Y, bLocal) * fStartClickLen, GetPosition(selTrans) + GetDirect(selTrans, AXIS.Y, bLocal) * fLineLen) < m_fActiveDist)
            {
                nActiveAxis = AXIS.Y;
            }
            if (HandleUtility.DistanceToLine(GetPosition(selTrans) + GetDirect(selTrans, AXIS.Z, bLocal) * fStartClickLen, GetPosition(selTrans) + GetDirect(selTrans, AXIS.Z, bLocal) * fLineLen) < m_fActiveDist)
            {
                nActiveAxis = AXIS.Z;
            }
            if (((GIZMO_TYPE)m_nGizmoTypeIndex) == GIZMO_TYPE.SCALE)
            {
                if (HandleUtility.DistanceToLine(GetPosition(selTrans), GetPosition(selTrans)) < m_fActiveDist)
                {
                    nActiveAxis = AXIS.A;
                }
            }

            if (nActiveAxis != AXIS.NONE)
            {
                m_nActiveAxis  = nActiveAxis;
                m_bActiveLocal = bLocal;
                bSelected      = true;
            }
            else
            {
                m_nActiveAxis = AXIS.NONE;
            }
        }

        // draw Selected gizmo
        DrawGizmoAxis(AXIS.X, bLocal, fLineLen, fCapSize);
        DrawGizmoAxis(AXIS.Y, bLocal, fLineLen, fCapSize);
        DrawGizmoAxis(AXIS.Z, bLocal, fLineLen, fCapSize);

        // World Center Sphere
        Gizmos.color = Color.yellow;
        if (((GIZMO_TYPE)m_nGizmoTypeIndex) == GIZMO_TYPE.HAND)
        {
            Gizmos.color = new Color(Gizmos.color.r, Gizmos.color.g, Gizmos.color.b, m_fHandAlpha);
        }
        Gizmos.DrawSphere(Vector3.zero, cubeSize.x / 2.0f);

        // selected center
        if (((GIZMO_TYPE)m_nGizmoTypeIndex) == GIZMO_TYPE.SCALE)
        {
            if (m_nActiveAxis == AXIS.A && m_bActiveLocal == bLocal)
            {
                Gizmos.color = Color.white;
            }
            else
            {
                Gizmos.color = Color.cyan;
            }
            Gizmos.DrawCube(GetPosition(selTrans), cubeSize);
        }

        // Gizmo tooltip
        if (IsLocalSpace())
        {
            m_GizmoTooltip = "GizmosLength = " + fLineLen.ToString("0.000") + " , long=Local";
        }
        else
        {
            m_GizmoTooltip = "GizmosLength = " + fLineLen.ToString("0.000") + " , long=World, shot=Local";
        }
        FXMakerMain.inst.SetEmptyTooltip(m_GizmoTooltip);

        return(bSelected);
    }
    void OnDrawGizmos()
    {
        Gizmos.color = new Color(1, 0, 0, 1f);
        for (int i = 0; i < centerWorldTiles.Count; i++)
        {
            Gizmos.DrawCube(new Vector3(centerWorldTiles[i].x, 0, centerWorldTiles[i].y), new Vector3(1, 1, 1));
        }
        Gizmos.color = Color.yellow;
        for (int i = 0; i < worldMidpoints.Count; i++)
        {
            Gizmos.DrawCube(new Vector3(worldMidpoints[i].x, worldMidpoints[i].y, 0), new Vector3(1, 1, 1));
        }

        Gizmos.color = Color.black;
        for (int x = 0; x < size; x++)
        {
            for (int y = 0; y < size; y++)
            {
                if (y == size - 1 || x == size - 1 || y == 0 || x == 0)
                {
                    Gizmos.DrawCube(grid.GetCellCenterWorld(new Vector3Int(x, y, 0)), new Vector3(1, 1, 1));
                }
            }
        }

        Gizmos.color = Color.green;
        for (int x = 0; x < size; x++)
        {
            for (int i = 0; i < worldCornerPoints.Count; i++)
            {
                Gizmos.DrawCube(worldCornerPoints[i], new Vector3(1, 1, 1));
            }
        }

        //Delaunay Triangulation
        Gizmos.color = Color.red;
        if (mesh != null && showDelaunay == true)
        {
            foreach (Edge edge in mesh.Edges)
            {
                Vertex  v0 = mesh.vertices[edge.P0];
                Vertex  v1 = mesh.vertices[edge.P1];
                Vector3 p0 = new Vector3((float)v0.x, 0.0f, (float)v0.y);
                Vector3 p1 = new Vector3((float)v1.x, 0.0f, (float)v1.y);
                Gizmos.DrawLine(p0, p1);
            }
        }

        //Minimum Spanning Tree
        Gizmos.color = Color.blue;
        if (mesh != null && showMST == true)
        {
            for (int i = 0; i < spanningTree.Count; i++)
            {
                Vertex  v0 = mesh.vertices[spanningTree[i].edge.P0];
                Vertex  v1 = mesh.vertices[spanningTree[i].edge.P1];
                Vector3 p0 = new Vector3((float)v0.x, 0.0f, (float)v0.y);
                Vector3 p1 = new Vector3((float)v1.x, 0.0f, (float)v1.y);
                Gizmos.DrawLine(p0, p1);
            }
        }
    }
 private void OnDrawGizmosSelected()
 {
     Gizmos.color = Color.red;
     Gizmos.DrawCube(wallHitBox.position, new Vector3(wallHitWidth, wallHitHeight, 1));
 }
Exemple #24
0
 void OnDrawGizmos()
 {
     Gizmos.color = new Color(1, 0, 0, 0.5f);
     Gizmos.DrawCube(focusArea.centre, focusAreaSize);
 }
Exemple #25
0
 private void OnDrawGizmos()
 {
     Gizmos.color = Color.green;
     Gizmos.DrawCube(GetComponent <Rigidbody>().worldCenterOfMass, new Vector3(1.0f, 1.0f, 1.0f));
 }
 private void OnDrawGizmos()
 {
     Gizmos.color = new Color(0, 0.4778554f, 1, 0.3f);
     Gizmos.DrawCube(focusArea.center, focusAreaSize);
 }
Exemple #27
0
 void OnDrawGizmos()
 {
     Gizmos.color = new Color(0, 1, 0.0f, 0.1f);
     Gizmos.DrawCube(Vector3.zero, Vector3.one);
 }
Exemple #28
0
 private void OnDrawGizmos()
 {
     Gizmos.color = GizmosColor;
     Gizmos.DrawCube(transform.position, new Vector3(transform.localScale.x * 3, transform.localScale.y, transform.localScale.z * 6));
 }
Exemple #29
0
        void OnDrawGizmos()
        {
            if (!active)
            {
                return;
            }

            Gizmos.color = color;

            switch (type)
            {
            case "Cube":
                if (!positionIsCenterCube)
                {
                    Gizmos.DrawCube(cubeCenter, cubeSize);
                }
                else
                {
                    Gizmos.DrawCube(this.transform.position, cubeSize);
                }
                break;

            case "Frustum":
                if (!positionIsCenterFrustum)
                {
                    Gizmos.DrawFrustum(frustumCenter, fov, maxRange, minRange, aspect);
                }
                else
                {
                    Gizmos.DrawFrustum(this.transform.position, fov, maxRange, minRange, aspect);
                }
                break;

            case "GUITexture":
                if (texture != null)
                {
                    Gizmos.DrawGUITexture(screenRect, texture, mat);
                }
                break;

            case "Icon":
                if (!positionIsCenterIcon)
                {
                    Gizmos.DrawIcon(iconCenter, iconName);
                }
                else
                {
                    Gizmos.DrawIcon(this.transform.position, iconName);
                }
                break;

            case "Line":
                if (!useTwoTransforms)
                {
                    Gizmos.DrawLine(fromV, toV);
                }
                else
                if (fromTr != null && toTr != null)
                {
                    Gizmos.DrawLine(fromTr.position, toTr.position);
                }
                break;

            case "Mesh":
                if (!transformIsMeshTransform)
                {
                    Gizmos.DrawMesh(mesh, subMeshIndex, meshPosition, Quaternion.Euler(meshRotation), meshScale);
                }
                else
                {
                    Gizmos.DrawMesh(mesh, subMeshIndex, this.transform.position, this.transform.rotation, this.transform.localScale);
                }
                break;

            case "Ray":
                Gizmos.DrawRay(fromR, directionR);
                break;

            case "Sphere":
                if (positionIsCenterSphere)
                {
                    Gizmos.DrawSphere(this.transform.position, radiusS);
                }
                else
                {
                    Gizmos.DrawSphere(sphereCenter, radiusS);
                }
                break;

            case "WireCube":
                if (!positionIsCenterWireCube)
                {
                    Gizmos.DrawWireCube(wireCubeCenter, wireCubeSize);
                }
                else
                {
                    Gizmos.DrawWireCube(this.transform.position, wireCubeSize);
                }
                break;

            case "WireMesh":
                if (!transformIsWireMeshTransform)
                {
                    Gizmos.DrawWireMesh(wireMesh, subWireMeshIndex, wireMeshPosition, Quaternion.Euler(wireMeshRotation), wireMeshScale);
                }
                else
                {
                    Gizmos.DrawWireMesh(wireMesh, subWireMeshIndex, this.transform.position, this.transform.rotation, this.transform.localScale);
                }
                break;

            case "WireSphere":
                if (positionIsCenterWireSphere)
                {
                    Gizmos.DrawWireSphere(this.transform.position, radiusWS);
                }
                else
                {
                    Gizmos.DrawWireSphere(wireSphereCenter, radiusWS);
                }
                break;

            case "CameraOrthographic":
                FastGizmosExtra.DrawCameraOrthographic(cam, color, drawVertex);
                break;

            case "LineExtended":
                if (!useTwoTransformsLE)
                {
                    FastGizmosExtra.DrawLineExtended(startPointLE, endPointLE, thickness);
                }
                else
                if (fromTrLE != null && toTrLE != null)
                {
                    FastGizmosExtra.DrawLineExtended(fromTrLE.position, toTrLE.position, thickness);
                }
                break;

            case "CubeExtended":
                FastGizmosExtra.DrawCubeExtended(positionCE, Quaternion.Euler(rotationCE.x, rotationCE.y, rotationCE.z), scaleCE);
                break;

            case "WireCubeExtended":
                FastGizmosExtra.DrawWireCubeExtended(positionWCE, Quaternion.Euler(rotationWCE.x, rotationWCE.y, rotationWCE.z), scaleWCE);
                break;
            }

            Gizmos.color = Color.white;
        }
Exemple #30
0
 void OnDrawGizmos()
 {
     colorGizmo();
     Gizmos.matrix = Matrix4x4.TRS((Vector2)transform.position + offset, transform.rotation, transform.localScale);
     Gizmos.DrawCube(Vector3.zero, new Vector3(size.x * 2, size.y * 2, 0)); // Because size is halfExtents
 }