예제 #1
0
    /// <summary>
    /// Draws the custom editor for this class settings.
    /// </summary>
    private void DrawSettings()
    {
        if (TDS_EditorUtility.FloatField("Juggle Speed", "Speed at which the Juggler juggle with his objects", juggleSpeed))
        {
            jugglers.ForEach(j => j.JuggleSpeed = juggleSpeed.floatValue);
            serializedObject.Update();
        }

        if (TDS_EditorUtility.FloatField("Throw. Dist. from Center", "Distance of each throwables from the hands transform of the character", throwableDistanceFromCenter))
        {
            jugglers.ForEach(j => j.ThrowableDistanceFromCenter = throwableDistanceFromCenter.floatValue);
            serializedObject.Update();
        }

        GUILayout.Space(5);

        TDS_EditorUtility.Vector3Field("Juggle Transf. Ideal Pos.", "Position the juggle transform is always looking to have (in local space)", juggleTransformIdealLocalPosition);

        // Draws a header for the juggler aim settings
        EditorGUILayout.LabelField("Aim", TDS_EditorUtility.HeaderStyle);

        GUILayout.Space(3);

        TDS_EditorUtility.PropertyField("What Can Aim", "Indicates what the player can aim at", whatCanAim);
        TDS_EditorUtility.PropertyField("Aim Detected Tags", "Detected tags as target when freely aiming", aimDetectTags);

        GUILayout.Space(2);

        if (TDS_EditorUtility.FloatSlider("Aiming Speed Coef", "Speed coefficient applied to the character while he's aiming", aimingSpeedCoef, 0f, 2f))
        {
            jugglers.ForEach(j => j.AimingSpeedCoef = aimingSpeedCoef.floatValue);
            serializedObject.Update();
        }
        if (TDS_EditorUtility.FloatField("Time between Shoots", "Minimum time to spend between two object shoots", timeBetweenShoots))
        {
            jugglers.ForEach(j => j.TimeBetweenShoots = timeBetweenShoots.floatValue);
            serializedObject.Update();
        }

        if (EditorApplication.isPlaying)
        {
            if (TDS_EditorUtility.FloatSlider("Aiming Angle", "Angle used by the Juggler to aim for a throw", aimAngle, 15f, 60f))
            {
                jugglers.ForEach(j => j.AimAngle = aimAngle.floatValue);
                serializedObject.Update();
            }

            TDS_EditorUtility.Vector3Field("Throw Aiming Point", "Position to aim when preparing a throw (in local space)", throwAimingPoint);
        }
    }
예제 #2
0
    protected override void DrawSettings()
    {
        base.DrawSettings();

        TDS_EditorUtility.PropertyField("Area activated by Mr Loyal", "Area used in the top phase of Mr Loyal", linkedAreas);
        TDS_EditorUtility.PropertyField("Cats", "Mr Loyal's cats", cats);
        TDS_EditorUtility.FloatSlider("Cats' charge rate", "Waiting seconds before the cats will attack", chargeCatsRate, 5, 25);
        TDS_EditorUtility.Vector3Field("Teleportation Position", "Position where Mr Loyal's will teleport himself", teleportationPosition);

        EditorGUILayout.LabelField("SOUNDS", TDS_EditorUtility.HeaderStyle);
        TDS_EditorUtility.PropertyField("Callout Fakir Sound", "", fakirAudioClip);
        TDS_EditorUtility.PropertyField("Callout Mime Sound", "", mimeAudioClip);
        TDS_EditorUtility.PropertyField("Callout Acrobat Sound", "", acrobatAudioClip);
        TDS_EditorUtility.PropertyField("Callout MightyMan Sound", "", mightyManAudioClip);
        TDS_EditorUtility.PropertyField("Callout Cat Sound", "", catAudioClip);
        TDS_EditorUtility.PropertyField("Taunt audio clips", "", tauntAudioClips);

        TDS_EditorUtility.FloatSlider("Main Taunt rate", "", tauntRateMin, 3, tauntRateMax.floatValue);
        TDS_EditorUtility.FloatSlider("Max Taunt rate", "", tauntRateMax, tauntRateMin.floatValue, 25);

        serializedObject.ApplyModifiedProperties();
    }
예제 #3
0
    /// <summary>
    /// Draws the editor for the Character class settings.
    /// </summary>
    private void DrawSettings()
    {
        // Draws a header for the character behaviour settings
        EditorGUILayout.LabelField("Behaviour", TDS_EditorUtility.HeaderStyle);

        GUILayout.Space(3);

        TDS_EditorUtility.Toggle("Pacific", "When pacific, the character will not attack", isPacific);

        TDS_EditorUtility.Toggle("Paralyzed", "When paralyzed, the character will no move", isParalyzed);

        // When on play and setting the toggle, do not change the property but execute the Flip method instead
        if (EditorApplication.isPlaying)
        {
            if (!isCharaMultiEditing && TDS_EditorUtility.Toggle("Facing Right Side", "Indicates if the character is currently facing the right side of the screen, or not", isFacingRight, false))
            {
                characters[0].Flip();
                serializedObject.Update();
            }
        }
        else
        {
            TDS_EditorUtility.Toggle("Facing Right Side", "Indicates if the character is currently facing the right side of the screen, or not", isFacingRight);
        }

        // Draws a header for the character behaviour settings
        EditorGUILayout.LabelField("Speed", TDS_EditorUtility.HeaderStyle);

        GUILayout.Space(3);

        // When on play and not multi editing, diplay a progress bar representing the current speed of the character
        if (EditorApplication.isPlaying)
        {
            if (!isCharaMultiEditing)
            {
                TDS_EditorUtility.ProgressBar(20, speedCurrent.floatValue / speedMax.floatValue, "Speed");
                GUILayout.Space(5);
            }
        }

        // If the serializedProperty is changed, triggers the property of the field
        // After the property has been used, update the object so that serializedProperties can be refresh
        if (TDS_EditorUtility.FloatSlider("Initial Speed", "Speed of the character when starting moving", speedInitial, 0, speedMax.floatValue))
        {
            characters.ForEach(c => c.SpeedInitial = speedInitial.floatValue);
            serializedObject.Update();
        }

        if (TDS_EditorUtility.FloatField("Max Speed", "Maximum speed of the character", speedMax))
        {
            characters.ForEach(c => c.SpeedMax = speedMax.floatValue);
            serializedObject.Update();
        }

        if (TDS_EditorUtility.FloatField("Speed Acceleration Time", "Time that take the character to get its speed to the maximum value, after starting moving (in seconds)", speedAccelerationTime))
        {
            characters.ForEach(c => c.SpeedAccelerationTime = speedAccelerationTime.floatValue);
            serializedObject.Update();
        }

        if (TDS_EditorUtility.FloatField("Speed Coefficient", "Global coefficient used to multiply all speed values for this character", speedCoef))
        {
            characters.ForEach(c => c.SpeedCoef = speedCoef.floatValue);
            serializedObject.Update();
        }

        if (!EditorApplication.isPlaying)
        {
            // Draws a header for the player aim settings
            EditorGUILayout.LabelField("Throwables & Aiming", TDS_EditorUtility.HeaderStyle);

            GUILayout.Space(3);

            if (TDS_EditorUtility.IntField("Throw max. Bonus Damages", "Maximum amount of bonus damages when throwing an object", throwBonusDamagesMax))
            {
                characters.ForEach(p => p.ThrowBonusDamagesMax = throwBonusDamagesMax.intValue);
                serializedObject.Update();
            }
            if (TDS_EditorUtility.IntSlider("Throw min. Bonus Damages", "Minimum amount of bonus damages when throwing an object", throwBonusDamagesMin, 0, throwBonusDamagesMax.intValue))
            {
                characters.ForEach(p => p.ThrowBonusDamagesMin = throwBonusDamagesMin.intValue);
                serializedObject.Update();
            }

            GUILayout.Space(3);

            if (TDS_EditorUtility.FloatSlider("Aiming Angle", "Angle used by this player to aim for a throw", aimAngle, 15f, 60f))
            {
                characters.ForEach(p => p.AimAngle = aimAngle.floatValue);
                serializedObject.Update();
            }

            TDS_EditorUtility.Vector3Field("Throw Aiming Point", "Position to aim when preparing a throw (Local space)", throwAimingPoint);
        }

        GUILayout.Space(3);
    }
    /// <summary>
    /// Draws the custom editor of the editing TDS_Camera objects.
    /// </summary>
    public void DrawEditor()
    {
        // Records any changements on the editing objects to allow undo
        Undo.RecordObjects(targets, "Camera script(s) settings");

        // Updates the SerializedProperties to get the latest values
        serializedObject.Update();

        TDS_EditorUtility.ObjectField("Camera", "Camera component attached to this script", camera, typeof(Camera));

        GUILayout.Space(1);

        if (TDS_EditorUtility.ObjectField("Target", "Target this camera has to follow", cTarget, typeof(Transform)))
        {
            cameras.ForEach(c => c.Target = (Transform)cTarget.objectReferenceValue);
        }

        GUILayout.Space(3);

        TDS_EditorUtility.ObjectField("Top Bound", "Top bound collider of this level", topBound, typeof(BoxCollider));
        TDS_EditorUtility.ObjectField("Left Bound", "Left bound collider of this level", leftBound, typeof(BoxCollider));
        TDS_EditorUtility.ObjectField("Right Bound", "Right bound collider of this level", rightBound, typeof(BoxCollider));
        TDS_EditorUtility.ObjectField("Bottom Bound", "Bottom bound collider of this level", bottomBound, typeof(BoxCollider));

        GUILayout.Space(3);

        TDS_EditorUtility.PropertyField("Current Bounds", "Current bounds of the camera", currentBounds);

        GUILayout.Space(3);

        TDS_EditorUtility.PropertyField("Level Bounds", "Global bounds of the camera in the Level", levelBounds);

        TDS_EditorUtility.Vector3Field("Offset", "Offset of the camera from its target", offset);

        GUILayout.Space(1);

        if (TDS_EditorUtility.FloatSlider("Rotation", "Rotation in X axis of the camera", rotation, 0, 90))
        {
            cameras.ForEach(c => c.Rotation = rotation.floatValue);
        }

        GUILayout.Space(2);

        if (EditorApplication.isPlaying && !serializedObject.isEditingMultipleObjects)
        {
            TDS_EditorUtility.ProgressBar(20, speedCurrent.floatValue / speedMax.floatValue, "Speed");
        }

        if (TDS_EditorUtility.FloatSlider("Initial Speed", "Initial speed of the camera when starting moving", speedInitial, 0, speedMax.floatValue))
        {
            cameras.ForEach(c => c.SpeedInitial = speedInitial.floatValue);
        }
        if (TDS_EditorUtility.FloatField("Max Speed", "Maximum value of this camera speed", speedMax))
        {
            cameras.ForEach(c => c.SpeedMax = speedMax.floatValue);
        }
        if (TDS_EditorUtility.FloatField("Speed Coef", "Coefficient used to multiply the speed of the camera", speedCoef))
        {
            cameras.ForEach(c => c.SpeedCoef = speedCoef.floatValue);
        }
        if (TDS_EditorUtility.FloatField("Speed Accl. Time", "Time the speed of the camera take from its initial value to reach its maximum value", speedAccelerationTime))
        {
            cameras.ForEach(c => c.SpeedAccelerationTime = speedAccelerationTime.floatValue);
        }
        TDS_EditorUtility.FloatField("Viewport Y Max Bound Value", "This would be too complicated to describe here...", ViewportYMaxBoundValue);

        GUILayout.Space(5);

        TDS_EditorUtility.RadioToggle("Moving", "Is the camera currently moving", isMoving);

        // Apply modifications
        serializedObject.ApplyModifiedProperties();
    }
예제 #5
0
    /// <summary>
    /// Draws the editor of the editing scripts.
    /// </summary>
    public void DrawEditor()
    {
        // Make a space at the beginning of the editor
        GUILayout.Space(10);
        Color _originalColor    = GUI.backgroundColor;
        Color _originalGUIColor = GUI.color;

        GUI.backgroundColor = TDS_EditorUtility.BoxDarkColor;
        EditorGUILayout.BeginVertical("HelpBox");
        GUILayout.Space(3);

        serializedObject.Update();

        TDS_EditorUtility.Toggle("Destroy on Activate", "Should this object be destroyed when activated", doDestroyOnActivate);

        if (!doDestroyOnActivate.boolValue)
        {
            TDS_EditorUtility.Toggle("Disable on Activate", "Should this object be disable when activated", doDisableOnActivate);
        }

        GUILayout.Space(2);
        TDS_EditorUtility.PropertyField("Activation mode", "Activation mode used to trigger these bounds", activationMode);

        if (activationMode.enumValueIndex < 2)
        {
            GUILayout.Space(3);
            GUI.backgroundColor = _originalColor;

            TDS_EditorUtility.PropertyField("Detected Tags", "Tags detected to trigger this event", detectedTags);

            GUI.backgroundColor = TDS_EditorUtility.BoxDarkColor;
        }

        GUILayout.Space(5);
        GUI.backgroundColor = _originalColor;
        EditorGUILayout.BeginHorizontal();

        TDS_EditorUtility.Vector3Field("Top Bound", "Top bound position", topBound);

        GUI.color = editingBound == 1 ? Color.grey : Color.cyan;
        if (GUILayout.Button("EDIT", GUILayout.Width(40)))
        {
            if (editingBound != 1)
            {
                editingBound = 1;
            }
            else
            {
                editingBound = 0;
            }
        }
        if (bottomBound.vector3Value != Vector3.zero)
        {
            GUI.color = new Color(.9f, .7f, .3f);

            if (GUILayout.Button(new GUIContent("BOTT. SET", "Set the position of the top bound to match the camera size with the bottom bound"), GUILayout.Width(75)))
            {
                Undo.RecordObjects(serializedObject.targetObjects, "set bottom bound position");

                topBound.vector3Value = new Vector3(topBound.vector3Value.x, topBound.vector3Value.y, bottomBound.vector3Value.z + 16.5f);
            }
        }

        GUI.color = _originalGUIColor;
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();

        TDS_EditorUtility.Vector3Field("Left Bound", "Left bound position", leftBound);

        GUI.color = editingBound == 2 ? Color.grey : Color.cyan;
        if (GUILayout.Button("EDIT", GUILayout.Width(40)))
        {
            if (editingBound != 2)
            {
                editingBound = 2;
            }
            else
            {
                editingBound = 0;
            }
        }
        if (rightBound.vector3Value != Vector3.zero)
        {
            GUI.color = new Color(.9f, .7f, .3f);

            if (GUILayout.Button(new GUIContent("RIGH. SET", "Set the position of the left bound to match the camera size with the right bound"), GUILayout.Width(75)))
            {
                Undo.RecordObjects(serializedObject.targetObjects, "set bottom bound position");

                leftBound.vector3Value = new Vector3(rightBound.vector3Value.x - (Camera.main.orthographicSize * 2 * ((float)Screen.currentResolution.width / Screen.currentResolution.height)), leftBound.vector3Value.y, leftBound.vector3Value.z);
            }
        }

        GUI.color = _originalGUIColor;
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();

        TDS_EditorUtility.Vector3Field("Right Bound", "Right bound rightBound", rightBound);

        GUI.color = editingBound == 3 ? Color.grey : Color.cyan;
        if (GUILayout.Button("EDIT", GUILayout.Width(40)))
        {
            if (editingBound != 3)
            {
                editingBound = 3;
            }
            else
            {
                editingBound = 0;
            }
        }
        if (leftBound.vector3Value != Vector3.zero)
        {
            GUI.color = new Color(.9f, .7f, .3f);

            if (GUILayout.Button(new GUIContent("LEFT SET", "Set the position of the right bound to match the camera size with the left bound"), GUILayout.Width(75)))
            {
                Undo.RecordObjects(serializedObject.targetObjects, "set bottom bound position");

                rightBound.vector3Value = new Vector3(leftBound.vector3Value.x + (Camera.main.orthographicSize * 2 * ((float)Screen.currentResolution.width / Screen.currentResolution.height)), rightBound.vector3Value.y, rightBound.vector3Value.z);
            }
        }

        GUI.color = _originalGUIColor;
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();

        TDS_EditorUtility.Vector3Field("Bottom Bound", "Bottom bound position", bottomBound);

        GUI.color = editingBound == 4 ? Color.grey : Color.cyan;
        if (GUILayout.Button("EDIT", GUILayout.Width(40)))
        {
            if (editingBound != 4)
            {
                editingBound = 4;
            }
            else
            {
                editingBound = 0;
            }
        }
        if (topBound.vector3Value != Vector3.zero)
        {
            GUI.color = new Color(.9f, .7f, .3f);

            if (GUILayout.Button(new GUIContent("TOP SET", "Set the position of the bottom bound to match the camera size with the top bound"), GUILayout.Width(75)))
            {
                Undo.RecordObjects(serializedObject.targetObjects, "set bottom bound position");

                bottomBound.vector3Value = new Vector3(bottomBound.vector3Value.x, bottomBound.vector3Value.y, topBound.vector3Value.z - 16.5f);
            }
        }

        GUI.color = _originalGUIColor;
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(5);

        EditorGUILayout.EndVertical();
        serializedObject.ApplyModifiedProperties();
    }