understanding enumerations

ok so I’m working on understanding enumerations better. lets say I have this project, and my character has oh idk 5 attacks. and my script is set up kinda like this.

	public enum Attack{
		Power,
		Cost,
		Type
	}
	
	private Attack[] _attack;
	
	private int max_num_attacks = 4;

	// Use this for initialization
	void Start(){
		for(int i = 0;i < max_num_attacks; i++){
			_attack[i].Power = i;
			Debug.Log(_attack[i].Power);
		}
	}

ok that’s just a quick example I whipped up and not necessarily how I’d do it but still, hopefully it shows what I’m getting at here.

I now have an array of 5 attacks, and each one is of my enumeration type Attack, so each one will have its own Power, Cost, and Type values. am I correct in thinking this?

No, what you are looking for is a struct or class.

enums are used to replace “magic numbers” A.K.A. numbers that only make sense to the guy who wrote it (if that :p)

An enum example:

public enum Attack{
	Melee,
	Range,
}

Attack attack=Attack.Melee;

void Update () {
    if (attack == Attack.Melee {
        MeleeAttack ();
    } else if (attack == Attack.Range) {
        RangeAttack ();
    }
}

ohh ok lol thanks. I’ll go look up structs then.

Edit: yup that’s exactly what I was wanting lol.