Exemplo n.º 1
0
        public void OnGUI()
        {
            SimGUIUtil.contextHelpText = HelpText;

            GUILayout.BeginArea(SimGUIUtil.contextControlZone, GUI.skin.box);
            mPolyRefs.OnGUI();
            GUILayout.EndArea();

            LabelRegion labels = SimGUIUtil.labels;

            labels.Clear();
            const int LabelCount = 3;
            int       slot       = labels.SlotCount - 1 - LabelCount;

            if (mHitParam > 1)
            {
                labels.Set(slot++, "Hit parameter", "Ray hit goal.");
            }
            else
            {
                labels.Set(slot++, "Hit parameter", string.Format("{0:F2}", mHitParam));
            }

            labels.Set(slot++, "Hit normal", Vector3Util.ToString(mHitNorm));
            labels.Set(slot++, "Path length", mResultCount.ToString());

            labels.Last = mMessages;
        }
Exemplo n.º 2
0
        public void OnGUI()
        {
            GUILayout.BeginArea(SimGUIUtil.contextControlZone, GUI.skin.box);
            mPolyRefs.OnGUI();
            GUILayout.EndArea();

            LabelRegion labels = SimGUIUtil.labels;

            labels.Clear();

            const int LabelCount = 2;
            int       slotIndex  = labels.SlotCount - 1 - LabelCount;

            if (mHasPosition)
            {
                labels.Set(slotIndex++, "Polygons found", mResultCount.ToString());
            }
            else
            {
                labels.Set(slotIndex++, "Polygons found", "0");
            }

            labels.Set(slotIndex++, "Search Radius", string.Format("{0:F2}", mSearchRadius));

            labels.Last = mMessage;
        }
Exemplo n.º 3
0
        protected virtual void HandleControls()
        {
            mShowClosedList = !GUILayout.Toggle(!mShowClosedList, "Show path");
            mShowClosedList = GUILayout.Toggle(mShowClosedList, "Show closed list");
            mUseAutoAdvance = GUILayout.Toggle(mUseAutoAdvance, "Auto-advance path");

            path.OnGUI();
        }
Exemplo n.º 4
0
        public void OnGUI()
        {
            if (mResultCount > 0)
            {
                Camera cam = Camera.main;

                for (int i = 0; i < mResultCount; i++)
                {
                    if (mParentRefs[i] == 0)
                    {
                        continue;
                    }

                    Vector3 center = GetBufferedCentroid(mPolyRefs.buffer[i]);

                    center   = cam.WorldToScreenPoint(center);
                    center.y = cam.pixelHeight - center.y + 4;

                    GUI.Label(new Rect(center.x, center.y, 100, SimGUIUtil.LineHeight)
                              , string.Format("{0:F2}", mCosts[i]));
                }
            }

            GUILayout.BeginArea(SimGUIUtil.contextControlZone, GUI.skin.box);
            mPolyRefs.OnGUI();
            GUILayout.EndArea();

            LabelRegion labels = SimGUIUtil.labels;

            labels.Clear();

            const int LabelCount = 2;
            int       slotIndex  = labels.SlotCount - 1 - LabelCount;

            if (mHasPosition)
            {
                labels.Set(slotIndex++, "Polygons found", mResultCount.ToString());
            }
            else
            {
                labels.Set(slotIndex++, "Polygons found", "0");
            }

            labels.Set(slotIndex++, "Search Radius", string.Format("{0:F2}", mSearchRadius));

            labels.Last = mMessage;
        }
Exemplo n.º 5
0
        public void OnGUI()
        {
            SimGUIUtil.contextHelpText = HelpText;

            GUILayout.BeginArea(SimGUIUtil.contextControlZone, GUI.skin.box);
            mPolyRefs.OnGUI();
            GUILayout.EndArea();

            LabelRegion labels = SimGUIUtil.labels;

            labels.Clear();
            const int LabelCount = 1;
            int       slot       = labels.SlotCount - 1 - LabelCount;

            labels.Set(slot++, "Visited Polys", mVisitedCount.ToString());

            labels.Last = mMessages;
        }
Exemplo n.º 6
0
        public void OnGUI()
        {
            GUILayout.BeginArea(SimGUIUtil.contextControlZone, GUI.skin.box);

            mPolyRefs.OnGUI();

            GUILayout.EndArea();

            LabelRegion labels = SimGUIUtil.labels;

            labels.Clear();
            labels.Last = mMessage;

            const int LabelCount = 3;
            int       iSlot      = labels.SlotCount - 1 - LabelCount;

            string msg = mResultCount + " (";

            for (int i = 0; i < mResultCount; i++)
            {
                msg += mPolyRefs.buffer[i].ToString() + ((i == mResultCount - 1) ? "" : ",");
            }


            msg += ")";

            labels.Set(iSlot++, "Polys Found", msg);

            if (mHasPosition)
            {
                labels.Set(iSlot++, "Geometry Point", Vector3Util.ToString(mPosition));
            }
            else
            {
                labels.Set(iSlot++, "Geometry Point", "None");
            }

            labels.Set(iSlot++, "Search Extents", Vector3Util.ToString(mHelper.extents));
        }
Exemplo n.º 7
0
 protected override void HandleControls()
 {
     base.HandleControls();
     mStraightPath.OnGUI();
 }
Exemplo n.º 8
0
    void OnGUI()
    {
        if (SimGUIUtil.hideGUI || mGroup.mesh == null)
        {
            return;
        }

        LabelRegion labels = SimGUIUtil.labels;

        labels.Clear();

        if (mPathCount == 0)
        {
            labels.Last = "No path.";
            SimGUIUtil.OnGUI();
            return;
        }

        GUILayout.BeginArea(SimGUIUtil.contextControlZone, GUI.skin.box);

        if (GUILayout.Button("Optimize Topology"))
        {
            mCorridor.OptimizePathTopology(true);
        }

        GUI.enabled = (mPathEnd.polyRef != 0);
        if (GUILayout.Button("Replan Path"))
        {
            FindPath();
        }

        GUI.enabled = true;

        mPath.OnGUI();
        if (mPath.HandleResize())
        {
            HandlePathBufferResize();
        }

        mCornerPolys.OnGUI();
        if (mCornerPolys.HandleResize())
        {
            mCorridor.ResizeCornerBuffer(mCornerPolys.MaxElementCount);
        }

        GUILayout.Label("Optimiation Range");

        GUILayout.BeginHorizontal();

        optimizationRange = (int)GUILayout.HorizontalSlider(optimizationRange, 1, 30);

        GUILayout.Label(optimizationRange.ToString());

        GUILayout.EndHorizontal();

        GUILayout.EndArea();

        const int LabelCount = 2;
        int       slotIndex  = labels.SlotCount - LabelCount;

        string msg = mCorridor.Corners.cornerCount + " of " + (mCorridor.Corners.MaxCorners - 1);

        labels.Set(slotIndex++, "Detected Corners", msg);

        msg = mPathCount + " of " + mCorridor.MaxPathSize;
        labels.Set(slotIndex++, "Corridor Polygons", msg);

        SimGUIUtil.OnGUI();
    }