update 1.2.0

This commit is contained in:
2025-07-20 10:05:55 +08:00
parent 2afbbf9be4
commit 5396d3e4b8
102 changed files with 93826 additions and 357 deletions
@@ -13,12 +13,12 @@ namespace EmeraldAI.Utility
{
GUIStyle FoldoutStyle;
FieldInfo[] CustomFields;
SerializedProperty AbilityName, AbilityIcon, DerivedSettingsFoldout, InfoSettingsFoldout, HideSettingsFoldout, ModularSettingsFoldout, CooldownSettings;
SerializedProperty AbilityName, AbilityIcon, DerivedSettingsFoldout, InfoSettingsFoldout, HideSettingsFoldout, ModularSettingsFoldout, CooldownSettings, ConditionSettings, SummonSettings;
SerializedProperty MeleeSettings, ProjectileSettings, ArrowProjectileSettings, GrenadeSettings, GeneralProjectileSettings, BulletProjectileSettings, AerialProjectileSettings, GroundProjectileSettings, BarrageProjectileSettings, TeleportSettings, HomingSettings, TargetTypeSettings,
SpreadSettings, ColliderSettings, CreateSettings, ChargeSettings, AreaOfEffectSettings, DamageSettings, StunnedSettings;
SpreadSettings, ColliderSettings, CreateSettings, ChargeSettings, AreaOfEffectSettings, DamageSettings, StunnedSettings, HealingSettings;
string ChargeSettingsTooltip = "Allows the ability to play an effect and/or sound when it is charging. The location of this effect is determined by the Attack Transform " +
"name passed through the ChargeEffect animation event. In order to use this setting, it must be set to true.\n\nNote: An ChargeEffect animation event is required for this to trigger. This should be done through the AI's attack animations before the EmeraldAttack animation event is called.";
"name passed through the ChargeEffect animation event. In order to use this setting, it must be set to true.\n\nNote: A ChargeEffect animation event is required for this to trigger. This should be done through the AI's attack animations before the EmeraldAttack animation event is called.";
string CreateSettingsTooltip = "Allows the ability to play an effect and/or sound when it is created. The location of this effect is determined by the Attack Transform " +
"name passed through the CreateAbility. In order to use this setting, it must be set to true.";
string MeleeSettingsTooltip = "Allows an ability to deal damage within the specified angle and distance.\n\nNote: " +
@@ -39,8 +39,12 @@ namespace EmeraldAI.Utility
string AreaOfEffectSettingsTooltip = "Allows an ability to affect the specified area with";
string StunSettingsTooltip = "Allows abilities the chance to stun a successfully hit target.";
string DamageSettingsTooltip = "Allows abilities to deal damage to a successfully hit target.";
string HealSettingsTooltip = "Allows abilities to heal friendly AI targets.";
string GrenadeSettingsTooltip = "Controls the settings for the Grenade Ability.";
string CooldownSettingsTooltip = "Allows abilities to have cooldowns so they can't be used more than what's set by the Cooldown Length amount.\n\nNote: The Cooldown Module only works with the Random and Odds Attack Pick Types (from the Combat Component).";
string CooldownSettingsTooltip = "Allows abilities to have cooldowns so they can't be used more than what's set by the Cooldown Length amount.";
string ConditionSettingsTooltip = "Abilities that use a Condition Module will need to have their condition met in order to be triggered. " +
"Conditions that are High Priorty will ignore an AI's Pick Type and be picked first, given the condition is met.\n\nNote: If the condition is not met, this ability will be skipped.";
string SummonSettingsTooltip = "Controls the settings for the Summong Ability.\n\nNote: The Summon Ability can only spawn Emerald AI agents.";
void OnEnable()
@@ -54,6 +58,7 @@ namespace EmeraldAI.Utility
AbilityName = serializedObject.FindProperty("AbilityName");
AbilityIcon = serializedObject.FindProperty("AbilityIcon");
CooldownSettings = serializedObject.FindProperty("CooldownSettings");
ConditionSettings = serializedObject.FindProperty("ConditionSettings");
MeleeSettings = serializedObject.FindProperty("MeleeSettings");
ProjectileSettings = serializedObject.FindProperty("ProjectileSettings");
BulletProjectileSettings = serializedObject.FindProperty("BulletProjectileSettings");
@@ -73,6 +78,8 @@ namespace EmeraldAI.Utility
AreaOfEffectSettings = serializedObject.FindProperty("AreaOfEffectSettings");
DamageSettings = serializedObject.FindProperty("DamageSettings");
StunnedSettings = serializedObject.FindProperty("StunnedSettings");
HealingSettings = serializedObject.FindProperty("HealingSettings");
SummonSettings = serializedObject.FindProperty("SummonSettings");
//Get all variables that are not part of the parent class.
CustomFields = target.GetType().GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
@@ -149,6 +156,10 @@ namespace EmeraldAI.Utility
if (CooldownSettings != null) DrawModule(CooldownSettings, "Cooldown Module", CooldownSettingsTooltip, false);
if (ConditionSettings != null) DrawConditionModule(ConditionSettings, "Condition Module", ConditionSettingsTooltip, false);
if (SummonSettings != null) DrawSummonModule(SummonSettings, "Summon Module", SummonSettingsTooltip, true);
if (MeleeSettings != null) DrawModule(MeleeSettings, "Melee Module", MeleeSettingsTooltip, true);
if (ColliderSettings != null) DrawModule(ColliderSettings, "Collider Module", ColliderSettingsTooltip, true);
@@ -169,6 +180,7 @@ namespace EmeraldAI.Utility
if (SpreadSettings != null) DrawModule(SpreadSettings, "Spread Module", SpreadSettingsTooltip);
if (DamageSettings != null) DrawDamageModule(DamageSettings, "Damage Module", DamageSettingsTooltip);
if (StunnedSettings != null) DrawModule(StunnedSettings, "Stunned Module", StunSettingsTooltip);
if (HealingSettings != null) DrawHealingModule(HealingSettings, "Heal Module", HealSettingsTooltip, true);
foreach (FieldInfo field in CustomFields)
@@ -353,6 +365,204 @@ namespace EmeraldAI.Utility
GUILayout.Space(2.5f);
}
void DrawHealingModule(SerializedProperty property, string Name, string Tooltip, bool Required = false)
{
CustomEditorProperties.BeginFoldoutWindowBox();
GUILayout.BeginHorizontal();
{
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginDisabledGroup(true);
property.FindPropertyRelative("Enabled").boolValue = EditorGUILayout.Toggle(property.FindPropertyRelative("Enabled").boolValue, GUILayout.Width(28));
property.FindPropertyRelative("Foldout").boolValue = EditorGUILayout.Foldout(property.FindPropertyRelative("Foldout").boolValue, new GUIContent(Name, "(Required) " + Tooltip), true);
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndHorizontal();
}
GUILayout.Space(5);
GUILayout.EndHorizontal();
if (property.FindPropertyRelative("Foldout").boolValue)
{
CustomEditorProperties.BeginIndent(45);
EditorGUILayout.PropertyField(property.FindPropertyRelative("TargetType"));
GUILayout.Space(2.5f);
CustomEditorProperties.BeginIndent(15);
if (property.FindPropertyRelative("TargetType").intValue == 0) //Self
{
}
else if (property.FindPropertyRelative("TargetType").intValue == 1) //Target
{
EditorGUILayout.PropertyField(property.FindPropertyRelative("Radius"));
}
else if (property.FindPropertyRelative("TargetType").intValue == 2) //Area
{
EditorGUILayout.PropertyField(property.FindPropertyRelative("Radius"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("Delay"));
}
CustomEditorProperties.EndIndent();
GUILayout.Space(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealingEffect"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealingEffectTimeoutSeconds"));
if (property.FindPropertyRelative("TargetType").intValue == 2) //Area
{
EditorGUILayout.PropertyField(property.FindPropertyRelative("EffectHeightOffset"));
}
GUILayout.Space(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealingType"));
GUILayout.Space(2.5f);
CustomEditorProperties.BeginIndent(15);
if (property.FindPropertyRelative("HealingType").intValue == 0)
{
EditorGUILayout.PropertyField(property.FindPropertyRelative("BaseHealAmount"));
}
else if (property.FindPropertyRelative("HealingType").intValue == 1)
{
EditorGUILayout.PropertyField(property.FindPropertyRelative("BaseHealAmount"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealsPerTick"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("TickRate"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealOverTimeLength"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealTickSounds"));
}
CustomEditorProperties.EndIndent();
GUILayout.Space(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealTargetEffect"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealTargetEffectTimeoutSeconds"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("HealingSoundsList"));
CustomEditorProperties.EndIndent();
}
GUILayout.Space(2.5f);
CustomEditorProperties.EndFoldoutWindowBox();
GUILayout.Space(2.5f);
}
void DrawSummonModule(SerializedProperty property, string Name, string Tooltip, bool Required = false)
{
CustomEditorProperties.BeginFoldoutWindowBox();
GUILayout.BeginHorizontal();
{
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginDisabledGroup(true);
property.FindPropertyRelative("Enabled").boolValue = EditorGUILayout.Toggle(property.FindPropertyRelative("Enabled").boolValue, GUILayout.Width(28));
property.FindPropertyRelative("Foldout").boolValue = EditorGUILayout.Foldout(property.FindPropertyRelative("Foldout").boolValue, new GUIContent(Name, "(Required) " + Tooltip), true);
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndHorizontal();
}
GUILayout.Space(5);
GUILayout.EndHorizontal();
if (property.FindPropertyRelative("Foldout").boolValue)
{
CustomEditorProperties.BeginIndent(45);
EditorGUILayout.PropertyField(property.FindPropertyRelative("CastEffect"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("CastEffectTimeoutSeconds"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("CastSounds"));
GUILayout.Space(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonEffect"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonEffectTimeoutSeconds"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonEffectHeightOffset"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonSounds"));
GUILayout.Space(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonAmount"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonPosition"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonRadius"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonDelay"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("AIPrefabs"));
GUILayout.Space(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("IsTimedSummon"));
GUILayout.Space(2.5f);
if (property.FindPropertyRelative("IsTimedSummon").boolValue)
{
CustomEditorProperties.BeginIndent(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("SummonLength"));
CustomEditorProperties.EndIndent();
EditorGUILayout.BeginVertical();
GUILayout.Space(5f);
EditorGUILayout.EndVertical();
}
EditorGUILayout.PropertyField(property.FindPropertyRelative("DespawnAfterKilled"));
GUILayout.Space(2.5f);
if (property.FindPropertyRelative("DespawnAfterKilled").boolValue)
{
CustomEditorProperties.BeginIndent(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("DespawnLength"));
CustomEditorProperties.EndIndent();
}
GUILayout.Space(15);
CustomEditorProperties.EndIndent();
}
GUILayout.Space(2.5f);
CustomEditorProperties.EndFoldoutWindowBox();
GUILayout.Space(2.5f);
}
void DrawConditionModule(SerializedProperty property, string Name, string Tooltip, bool Required = false)
{
CustomEditorProperties.BeginFoldoutWindowBox();
GUILayout.BeginHorizontal();
{
EditorGUILayout.BeginHorizontal();
property.FindPropertyRelative("Enabled").boolValue = EditorGUILayout.Toggle(property.FindPropertyRelative("Enabled").boolValue, GUILayout.Width(28));
property.FindPropertyRelative("Foldout").boolValue = EditorGUILayout.Foldout(property.FindPropertyRelative("Foldout").boolValue, new GUIContent(Name, "(Optional) " + Tooltip), true);
EditorGUILayout.EndHorizontal();
}
GUILayout.Space(5);
GUILayout.EndHorizontal();
if (property.FindPropertyRelative("Foldout").boolValue)
{
CustomEditorProperties.BeginIndent(45);
EditorGUILayout.PropertyField(property.FindPropertyRelative("HighPriority"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("ConditionType"));
GUILayout.Space(2.5f);
if ((ConditionTypes)property.FindPropertyRelative("ConditionType").enumValueIndex == ConditionTypes.DistanceFromTarget)
{
CustomEditorProperties.BeginIndent(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("ValueCompareType"));
EditorGUILayout.PropertyField(property.FindPropertyRelative("DistanceFromTarget"));
CustomEditorProperties.EndIndent();
EditorGUILayout.BeginVertical();
GUILayout.Space(5f);
EditorGUILayout.EndVertical();
}
else if ((ConditionTypes)property.FindPropertyRelative("ConditionType").enumValueIndex == ConditionTypes.AllyLowHealth ||
(ConditionTypes)property.FindPropertyRelative("ConditionType").enumValueIndex == ConditionTypes.SelfLowHealth)
{
CustomEditorProperties.BeginIndent(15);
EditorGUILayout.PropertyField(property.FindPropertyRelative("LowHealthPercentage"));
CustomEditorProperties.EndIndent();
EditorGUILayout.BeginVertical();
GUILayout.Space(5f);
EditorGUILayout.EndVertical();
}
CustomEditorProperties.EndIndent();
}
GUILayout.Space(2.5f);
CustomEditorProperties.EndFoldoutWindowBox();
GUILayout.Space(2.5f);
}
void SetModule (SerializedProperty property, bool State)
{
property.FindPropertyRelative("Enabled").boolValue = State;