Ejemplo n.º 1
0
    void DrawGUIArea2()
    {
        if (shakeGUI)
        {
            CameraShake.BeginShakeGUILayout();
        }
        else
        {
            GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));
        }

        GUILayout.BeginVertical();
        GUILayout.FlexibleSpace();
        GUILayout.Space(100);

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        GUI.enabled = !CameraShake.isShaking && !multiShake;

        shake1 = GUILayout.Toggle(shake1, "Shake (without GUI)", GUI.skin.button, GUILayout.Width(200), GUILayout.Height(50));
        shake2 = GUILayout.Toggle(shake2, "Shake (with GUI)", GUI.skin.button, GUILayout.Width(200), GUILayout.Height(50));

        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        GUILayout.BeginVertical(GUILayout.Width(300));

        GUILayout.Label("Number of Shakes: " + shake.numberOfShakes.ToString());

        shake.numberOfShakes = (int)GUILayout.HorizontalSlider(shake.numberOfShakes, 1, 10);

        GUILayout.Label("Shake Amount: " + shake.shakeAmount.ToString());

        float x, y, z;

        x = GUILayout.HorizontalSlider(shake.shakeAmount.x, 0, 2);
        y = GUILayout.HorizontalSlider(shake.shakeAmount.y, 0, 2);
        z = GUILayout.HorizontalSlider(shake.shakeAmount.z, 0, 2);

        if (x != shake.shakeAmount.x || y != shake.shakeAmount.y || z != shake.shakeAmount.z)
        {
            shake.shakeAmount = new Vector3(x, y, z);
        }

        GUILayout.Label("Rotation Amount: " + shake.rotationAmount.ToString());

        x = GUILayout.HorizontalSlider(shake.rotationAmount.x, 0, 10);
        y = GUILayout.HorizontalSlider(shake.rotationAmount.y, 0, 10);
        z = GUILayout.HorizontalSlider(shake.rotationAmount.z, 0, 10);

        if (x != shake.rotationAmount.x || y != shake.rotationAmount.y || z != shake.rotationAmount.z)
        {
            shake.rotationAmount = new Vector3(x, y, z);
        }

        GUILayout.Label("Distance: " + shake.distance.ToString("0.00"));

        shake.distance = GUILayout.HorizontalSlider(shake.distance, 0, .1f);

        GUILayout.Label("Speed: " + shake.speed.ToString("0.00"));

        shake.speed = GUILayout.HorizontalSlider(shake.speed, 1, 100);

        GUILayout.Label("Decay: " + shake.decay.ToString("0.00%"));

        shake.decay = GUILayout.HorizontalSlider(shake.decay, 0, 1);

        GUILayout.Space(5);

        GUILayout.Label("Presets:");

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Explosion"))
        {
            Explosion();
        }
        if (GUILayout.Button("Footsteps"))
        {
            Footsteps();
        }
        if (GUILayout.Button("Bumpy"))
        {
            Bumpy();
        }

        GUILayout.EndHorizontal();

        if (GUILayout.Button("Reset"))
        {
            Application.LoadLevel(Application.loadedLevel);
        }

        GUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        GUILayout.FlexibleSpace();
        GUILayout.EndVertical();

        GUI.enabled = true;

        if (shakeGUI)
        {
            CameraShake.EndShakeGUILayout();
        }
        else
        {
            GUILayout.EndArea();
        }
    }