Esempio n. 1
0
    private void DrawCatSettings()
    {
        EditorGUILayout.LabelField(serializedObject.targetObject.name, TDS_EditorUtility.HeaderStyle);
        TDS_EditorUtility.PropertyField("Cat State", "On which perch the cat is", catState);

        TDS_EditorUtility.PropertyField("Left Perch Infos", "Left perch infos", leftPerchInfos);
        TDS_EditorUtility.PropertyField("Right Perch Infos", "Left perch infos", rightPerchInfos);

        TDS_EditorUtility.PropertyField("Cat Attack", "Attack casted by the cat", catAttack);
        TDS_EditorUtility.FloatSlider("Charge Rate", "Rate using when the cat is independant", chargeRate, 5, 25);
        serializedObject.ApplyModifiedProperties();
    }
Esempio n. 2
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);
        }
    }
Esempio n. 3
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();
    }
Esempio n. 4
0
    /// <summary>
    /// Draw the editor for the variables settings of the enemy
    /// </summary>
    protected virtual void DrawSettings()
    {
        // Draw a header for the enemy detection settings
        EditorGUILayout.LabelField("Detection", TDS_EditorUtility.HeaderStyle);
        TDS_EditorUtility.FloatSlider("Wandering range Min", "The wandering distance around the targeted player when other enemies attacking an enemy", wanderingRangeMin, 1, wanderingRangeMax.floatValue);
        TDS_EditorUtility.FloatSlider("Wandering range Max", "The wandering distance around the targeted player when other enemies attacking an enemy", wanderingRangeMax, wanderingRangeMin.floatValue, 10);
        TDS_EditorUtility.FloatSlider("Taunt Probability", "The chance to taunt after wandering", tauntProbability, 0, 100);
        GUILayout.Space(3);

        //Draw a header for the enemy scale up settings
        EditorGUILayout.LabelField("Scale Up Settings", TDS_EditorUtility.HeaderStyle);
        TDS_EditorUtility.Toggle("Scale Up", "Should this enemy health scale up depending on player amount", doScaleOnPlayerAmount);
        if (doScaleOnPlayerAmount.boolValue)
        {
            if (TDS_EditorUtility.IntSlider("Health Scale Up Percent", "Percentage by which this enemy health is scaled up for each other player", healthScalePercent, 0, 100))
            {
                enemies.ForEach(e => e.HealthScalePercent = healthScalePercent.intValue);
                serializedObject.Update();
            }
        }

        GUILayout.Space(3);

        //Draw a header for the enemy down settings
        EditorGUILayout.LabelField("Damages Settings", TDS_EditorUtility.HeaderStyle);
        TDS_EditorUtility.Toggle("Can be grounded", "Is the enemy can be grounded", canBeDown);
        GUILayout.Space(3);

        // Draws a header for the enemy attacks settings
        TDS_EditorUtility.Toggle("Can Throw", "Is the enemy can throw objects", canThrow);
        if (canThrow.boolValue)
        {
            TDS_EditorUtility.FloatSlider("Throw Range", "Distance reached by the throwed object", throwRange, .5f, 20f);
        }

        GUILayout.Space(3);
    }
Esempio n. 5
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();
    }
Esempio n. 7
0
    /// <summary>
    /// Draws the settings editor of the TDS_Player editing objects.
    /// </summary>
    private void DrawSettings()
    {
        TDS_EditorUtility.PropertyField("Type of Player", "Type of character this player is", playerType);
        TDS_EditorUtility.PropertyField("Attacks", "All Attacks this player can perform", attacks);

        GUILayout.Space(5);

        TDS_EditorUtility.PropertyField("What is Obstacle", "What layers this player should collide on", whatIsObstacle);

        // Draws a header for the player combos settings
        EditorGUILayout.LabelField("Combo", TDS_EditorUtility.HeaderStyle);

        GUILayout.Space(3);

        // Draws informations about the current combo if in play mode
        if (EditorApplication.isPlaying && !isPlayerMultiEditing)
        {
            string _combo = string.Empty;
            for (int _i = 0; _i < comboCurrent.arraySize; _i++)
            {
                _combo += comboCurrent.GetArrayElementAtIndex(_i).boolValue ? "L" : "H";
            }

            TDS_EditorUtility.ProgressBar(25, (float)comboCurrent.arraySize / comboMax.intValue, $"Combo : {comboCurrent.arraySize} | {_combo}");

            GUILayout.Space(5);
        }

        if (TDS_EditorUtility.IntField("Max Combo", "Maximum amount of attacks in one combo", comboMax))
        {
            players.ForEach(p => p.ComboMax = comboMax.intValue);
            serializedObject.Update();
        }

        if (TDS_EditorUtility.FloatField("Combo Reset time", "Time it takes for a combo to automatically be reset when no attack is perform", comboResetTime))
        {
            players.ForEach(p => p.ComboResetTime = comboResetTime.floatValue);
            serializedObject.Update();
        }

        // Draws a header for the player special settings
        EditorGUILayout.LabelField("Special", TDS_EditorUtility.HeaderStyle);

        GUILayout.Space(3);

        TDS_EditorUtility.Toggle("Playable", "Is the player playable or not", isPlayable);

        // Draws a header for the player jump settings
        EditorGUILayout.LabelField("Jump", TDS_EditorUtility.HeaderStyle);

        GUILayout.Space(3);

        TDS_EditorUtility.FloatField("Jump Force", "Maximum amount of attacks in one combo", jumpForce);

        if (TDS_EditorUtility.FloatField("Jump Maximum Time Length", "Maximum time for a jump the player can continue to add force", jumpMaximumTime))
        {
            players.ForEach(p => p.JumpMaximumTime = jumpMaximumTime.floatValue);
            serializedObject.Update();
        }

        if (EditorApplication.isPlaying && (playerType.intValue != (int)PlayerType.Juggler))
        {
            // Draws a header for the player aim settings
            EditorGUILayout.LabelField("Aim", TDS_EditorUtility.HeaderStyle);

            GUILayout.Space(3);

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