Beispiel #1
0
    private void OnGUILine(string name, CoverCommand command, ref float floatValue, float maxValue)
    {
        GUILayout.BeginHorizontal();
        {
            floatValue = EditorGUILayout.FloatField(name, floatValue);

            floatValue = Mathf.Clamp(floatValue, 0, maxValue);

            GUI.enabled = CoverUtils.IsGameObjectSelected();

            if (GUILayout.Button("Modify selection", GUILayout.Width(m_ButtonSize)) == true)
            {
                ExecuteCommandOnSelectedCovers(command, floatValue, "CoverUtils: " + name);
            }

            GUI.enabled = true;
        }
        GUILayout.EndHorizontal();
    }
Beispiel #2
0
    void OnGUI()
    {
        GUILayout.BeginVertical();
        {
            GUILayout.Space(8);

            int buttonSize = 110;

            GUILayout.BeginHorizontal("");
            {
                if (GUILayout.Button("Scan scene", GUILayout.Width(buttonSize)) == true)
                {
                    Scan();
                }

                GUI.enabled = CoverUtils.IsGameObjectSelected();
                if (GUILayout.Button("Scan selection", GUILayout.Width(buttonSize)) == true)
                {
                    ScanSelection();
                }
                GUI.enabled = true;
            }
            GUILayout.EndHorizontal();


            m_VisualizeTests = GUILayout.Toggle(m_VisualizeTests, "Visualize tests");

            GUILayout.Space(8);

            if (m_Covers >= 0)
            {
                GUILayout.BeginVertical("");
                {
                    GUILayout.Label("Statistics");
                    OnGUIBreak(true);
                    OnGUILine("Covers count", m_Covers);

                    if (m_Covers > 0)
                    {
                        OnGUILine("Left crouch", m_FlagCrouchLeft);
                        OnGUILine("Right crouch", m_FlagCrouchRight);
                        OnGUILine("Up crouch", m_FlagCrouchUp);
                        OnGUILine("Left stand", m_FlagStandLeft);
                        OnGUILine("Right stand", m_FlagStandRight);
                        OnGUILine("Jump up", m_FlagJumpUp);

                        if (m_DistanceToWallCrouch.IsValid())
                        {
                            OnGUIBreak(false);
                            OnGUILine("Min dist to wall (crouch)", m_DistanceToWallCrouch.m_MinValue);
                            OnGUILine("Max dist to wall (crouch)", m_DistanceToWallCrouch.m_MaxValue);
                        }
                        if (m_DistanceToWallStand.IsValid())
                        {
                            OnGUIBreak(false);
                            OnGUILine("Min dist to wall (stand)", m_DistanceToWallStand.m_MinValue);
                            OnGUILine("Max dist to wall (stand)", m_DistanceToWallStand.m_MaxValue);
                        }
                        if (m_DistanceCrouchCorner.IsValid())
                        {
                            OnGUIBreak(false);
                            OnGUILine("Min dist to corner (crouch)", m_DistanceCrouchCorner.m_MinValue);
                            OnGUILine("Max dist to corner (crouch)", m_DistanceCrouchCorner.m_MaxValue);
                        }
                        if (m_DistanceStandCorner.IsValid())
                        {
                            OnGUIBreak(false);
                            OnGUILine("Min dist to corner (stand)", m_DistanceStandCorner.m_MinValue);
                            OnGUILine("Max dist to corner (stand)", m_DistanceStandCorner.m_MaxValue);
                        }
                    }

                    OnGUIBreak(true);
                }
                GUILayout.EndVertical();
            }
        }
        GUILayout.EndVertical();
    }