/// <summary> /// Draws the custom editor for this class settings. /// </summary> private void DrawSettings() { if (Application.isPlaying) { Color _originalColor = GUI.color; GUI.color = !isDrunk.boolValue ? new Color(.8f, .25f, .25f) : new Color(.25f, .8f, .25f); EditorGUILayout.BeginHorizontal(); GUILayout.Space(15); if (GUILayout.Button(!isDrunk.boolValue ? new GUIContent("Get Drunk", "Get the Fire Eater drunk") : new GUIContent("Get Sober", "Make the Fire Eater sober again"), GUILayout.Width(100), GUILayout.Height(20))) { foreach (TDS_FireEater _fireEater in fireEaters) { if (_fireEater.ComboCurrent.Count > 0) { _fireEater.BreakCombo(); } if (!isDrunk.boolValue) { _fireEater.GetDrunk(); } else { soberUpTimer.floatValue = 0; } } } EditorGUILayout.EndHorizontal(); GUI.color = _originalColor; GUILayout.Space(10); } if (TDS_EditorUtility.FloatField("Sober Up Time", "Time it takes to the Fire Eater to sober up (in seconds)", soberUpTime)) { fireEaters.ForEach(f => f.SoberUpTime = soberUpTime.floatValue); serializedObject.Update(); } if (TDS_EditorUtility.FloatField("Drunk Speed Coef", "Coefficient applied to speed when drunk", drunkSpeedCoef)) { fireEaters.ForEach(f => f.DrunkSpeedCoef = drunkSpeedCoef.floatValue); serializedObject.Update(); } TDS_EditorUtility.FloatField("X Mov. after Drunken Dodge", "Distance to move the Fire Eater before getting up after a drunken dodge", xMovementAfterDrunkenDodge); if (TDS_EditorUtility.IntField("Drunk Jump Force", "Force applied when performing a jump when drunk", drunkJumpForce)) { fireEaters.ForEach(f => f.DrunkJumpForce = drunkJumpForce.intValue); serializedObject.Update(); } GUILayout.Space(3); }
/// <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(); } }
/// <summary> /// Draws the custom editor for this class settings. /// </summary> private void DrawSettings() { if (Application.isPlaying) { if (TDS_EditorUtility.Toggle("Angry", "Indicates if the Fat Lady is in Angry or in \"Cool\" mode", isAngry)) { fatLadies.ForEach(f => f.IsAngry = isAngry.boolValue); serializedObject.Update(); } GUILayout.Space(5); } if (TDS_EditorUtility.FloatField("Angry Speed Coef", "Coefficient applied to the Fat Lady's speed when angry", angrySpeedCoef)) { fatLadies.ForEach(f => f.AngrySpeedCoef = angrySpeedCoef.floatValue); serializedObject.Update(); } if (TDS_EditorUtility.IntField("Angry Health Step", "Health value separating the Angry mode and the Cool one", angryHealthStep)) { fatLadies.ForEach(f => f.AngryHealthStep = angryHealthStep.intValue); serializedObject.Update(); } GUILayout.Space(3); if (Application.isPlaying) { if (TDS_EditorUtility.Toggle("Snack Available", "Indicates if the Fat Lady's snack is available for use", isSnackAvailable)) { fatLadies.ForEach(f => f.IsSnackAvailable = isSnackAvailable.boolValue); serializedObject.Update(); } GUILayout.Space(3); TDS_EditorUtility.ProgressBar(25, isSnackAvailable.boolValue ? 0 : snackRestaureTimer.floatValue / snackRestaureTime.floatValue, "Snack Restauration"); GUILayout.Space(3); } if (TDS_EditorUtility.FloatField("Snack Restaure Time", "Time i takes to restaure the snack after eating (in seconds)", snackRestaureTime)) { fatLadies.ForEach(f => f.SnackRestaureTime = snackRestaureTime.floatValue); serializedObject.Update(); } if (TDS_EditorUtility.IntField("Snack Heal Value", "Heal value when snacking", snackHealValue)) { fatLadies.ForEach(f => f.SnackHealValue = snackHealValue.intValue); serializedObject.Update(); } }
/// <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> /// 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 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(); } } }