/* TDS_SpawningInformationsEditor : * * ##################### * ###### PURPOSE ###### * ##################### * * Editor of the Random Spawning Information class * * ##################### * ### MODIFICATIONS ### * ##################### * * Date : [12/02/2019] * Author : [THIEBAUT Alexis] * * Changes : * * [Initialisation de la class] * - Implémentation de la methode OnGUI pour afficher les settings de la Random Spawning Information * ----------------------------------- */ #region Methods public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { base.OnGUI(position, property, label); // Display the chance of spawn for the random enemies if (property.FindPropertyRelative("isFoldOut").boolValue) { TDS_EditorUtility.IntSlider("Spawn Chance", "", property.FindPropertyRelative("spawnChance"), 1, 100); } }
protected override void DrawSettings() { base.DrawSettings(); EditorGUILayout.LabelField("Evolve", TDS_EditorUtility.HeaderStyle); TDS_EditorUtility.RadioToggle("Has Evolved", "Is the minion evolved", hasEvolved); GUILayout.Space(5); EditorGUILayout.LabelField("Rage", TDS_EditorUtility.HeaderStyle); TDS_EditorUtility.FloatField("Reset Rage Delay", "Delay to reset the rage", resetRageDelay); TDS_EditorUtility.IntSlider("Reset Rage Threshold", "Count of attacks to ignore the next damages", ragingThreshold, 1, 5); }
/// <summary> /// Draws the editor for the Destructible class settings. /// </summary> protected void DrawSettings() { TDS_EditorUtility.IntSlider("Loot Chance", "Chance in percentage to have drop on this destructible destruction", lootChance, 0, 100); GUILayout.Space(3); TDS_EditorUtility.IntSlider("Min Loot", "Minimum amount of loot for this destructible", lootMin, 0, lootMax.intValue); if (TDS_EditorUtility.IntField("Max Loot", "Maximum amount of loot for this destructible", lootMax)) { destructibles.ForEach(d => d.LootMax = lootMax.intValue); serializedObject.Update(); } }
protected override void DrawSettings() { base.DrawSettings(); TDS_EditorUtility.IntSlider("Damages Threshold", "How much damages had to be taken to play the hit animation", damagesThreshold, 1, 50); TDS_EditorUtility.ObjectField("Boss Portrait", "Portrait to display next to the boss' lifebar", portrait, typeof(GameObject)); EditorGUILayout.LabelField("Health events", TDS_EditorUtility.HeaderStyle); TDS_EditorUtility.PropertyField("On Two Thirds Health", "Event called when the boss has reached two thirds of his life", onTwoThirdsHealth); TDS_EditorUtility.PropertyField("On Half Health", "Event called when the boss has reached half of his life", onHalfHealth); TDS_EditorUtility.PropertyField("On One Third Health", "Event called when the boss has reached one third of his life", onOneThirdHealth); }
/// <summary> /// Draws the editor for Damageable class settings /// </summary> private void DrawSettings() { // 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.IntSlider("Health", "Current health of this object", healthCurrent, 0, healthMax.intValue)) { damageables.ForEach(d => d.HealthCurrent = healthCurrent.intValue); serializedObject.Update(); } if (!healthCurrent.hasMultipleDifferentValues) { GUILayout.Space(5); TDS_EditorUtility.ProgressBar(25, (float)healthCurrent.intValue / healthMax.intValue, "Health"); GUILayout.Space(5); } // If the application is playing, draws two button next to each other allowing the heal & damage the object if (EditorApplication.isPlaying) { DrawLifeButtons(); } if (TDS_EditorUtility.IntField("Max Health", "Maximum health of the object ; its health cannot exceed this value", healthMax)) { damageables.ForEach(d => d.HealthMax = healthMax.intValue); serializedObject.Update(); } if (TDS_EditorUtility.Toggle("Dead", "Indicates if the object is dead, or not", isDead)) { damageables.ForEach(d => d.IsDead = isDead.boolValue); serializedObject.Update(); } if (TDS_EditorUtility.Toggle("Indestructible", "When indestructible, the object will not be dead when its health reach zero", isIndestructible)) { damageables.ForEach(d => d.IsIndestructible = isIndestructible.boolValue); serializedObject.Update(); } TDS_EditorUtility.Toggle("Invulnerable", "When invulnerable, the object cannot take any damage", isInvulnerable); TDS_EditorUtility.Toggle("Can be Moved", "If set to true, this damageable can suffer the effects of special attack effect moving opponent", canBeMoved); GUILayout.Space(3); }
/// <summary> /// Draws the custom editor for this class settings. /// </summary> private void DrawSettings() { if (TDS_EditorUtility.PropertyField("Beard State", "Current state of the Beard Lady's beard", currentBeardState) && Application.isPlaying) { beardLadies.ForEach(b => b.CancelInvokeGrowBeard()); beardLadies.ForEach(b => b.CurrentBeardState = (BeardState)currentBeardState.enumValueIndex); serializedObject.Update(); } GUILayout.Space(3); TDS_EditorUtility.ProgressBar(25, (float)currentBeardState.enumValueIndex / 3, "Beard State"); GUILayout.Space(5); if (TDS_EditorUtility.FloatField("Beard Grow Interval", "Interval between two beard grow up", beardGrowInterval)) { beardLadies.ForEach(b => b.BeardGrowInterval = beardGrowInterval.floatValue); serializedObject.Update(); } if (TDS_EditorUtility.IntSlider("Beard Life", "Current beard life", beardCurrentLife, 0, beardMaxLife.intValue) && Application.isPlaying) { beardLadies.ForEach(b => b.BeardCurrentLife = beardCurrentLife.intValue); serializedObject.Update(); } GUILayout.Space(3); TDS_EditorUtility.ProgressBar(25, (float)beardCurrentLife.intValue / beardMaxLife.intValue, "Beard Life"); GUILayout.Space(5); if (TDS_EditorUtility.IntField("Beard Max Life", "Maximum beard life value", beardMaxLife)) { beardLadies.ForEach(b => b.BeardMaxLife = beardMaxLife.intValue); serializedObject.Update(); } if (TDS_EditorUtility.FloatField("Beard Heal Interval", "Interval between two beard heal", beardHealInterval)) { beardLadies.ForEach(b => b.BeardHealInterval = beardHealInterval.floatValue); serializedObject.Update(); } }
/// <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); }
/// <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); }