0

Context I am using a Unity ScriptableObject to define basic Enemy Stats

So I have an Enum for special damage types but some enemies might have resistances like Fire Elemental might obviously take no Fire Damage

So what I originally thought of was having an array that carries the number associated since both Enums and Arrays, start at zero. Zero on the Enum would correlate to zero for the array. This can be done I believe but it makes it hard to read cause there is no structure to display what it is 0 Physical? Fire? Cold?

So I would like to know how I can display it easily (hopefully in the Unity Inspector) other than commenting what each number is.

public enum SpecialDamageType
    { // What Resist affectes this attack
        Physical,
        Fire,
        Cold,
        Lightning,
        Hydro,
        Air,
    }
public struct DamageStatsStruct
{
    public float weaponDamagef;
    public float weaponArmourPeircingf;
    public WeaponDamageType weaponDamageType;
    public float SpecialCaseDurationf;
    public float SpecialCaseStrengthf;
    public SpecialCaseType specialCaseType;
    public float specialDamagef;
    public SpecialDamageType specialDamageType;
}
public class EnemyParent : ScriptableObject
{ // Abstract Class
    // Finish Get Set for Variables
    [Header("Enemy Details")]
    [SerializeField] public string enemyName;
    [SerializeField] public string enemyDesc;

    [Header("Enemy Stats")]
    [SerializeField] public float enemyMaxHealthf;
    [SerializeField] protected float enemyArmourf;
    [SerializeField] protected float enemyMaxShield;
    [SerializeField] protected float enemyWalkSpeed;
    [SerializeField] protected float enemyRunSpeed;


    

}

If you need any more info, I would be happy to supply Thanks for any feedback

I know I can get the array to work, just would like an easier-read version through the Unity Inspector

  • 1
    From a C# perspective, a [Dictionary](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-7.0) would probably be my first choice, however dictionaries don't show up in the inspector. Instead, as mentioned in [this answer](https://gamedev.stackexchange.com/a/74408), you can create an object that has a property for each item then create an array of this object. That should get it to show up in the editor. – Jesse Oct 26 '22 at 20:46
  • I don't know anything about the unity inspector, but you can store the actual enumerations in an array and then access them by index. Would that work? – David L Oct 26 '22 at 21:06
  • I think that will work for me Jesse! Thank you! and I will look into that as well David, thank you as well! – Hiyazcool Oct 26 '22 at 21:18

0 Answers0