Skip to main content
2 of 4
added 285 characters in body
Jon
  • 3.7k
  • 1
  • 14
  • 23

You can override the type of the enum, if needed:

enum CombatMove : int //implied
{
   RightMiddleJab = 0, //0
   LeftMiddleJab = 1,  //1
   RightUpperJab = 3,  //3
   LeftUpperJab,       //4
}

And since you can cast them, there is probably no reason to refer to them by name:

CombatMove combatMove = CombatMove.LeftUpperJab;
int combatMoveValue = (int)combatMove;

I don't know exactly what you are trying to index, both types are arbitrary:

using System.Collections.Generic;
Dictionary<CombatMove, AnimationClip> AnimationClipsByEnum;
AnimationClipsByEnum[CombatMove.RightMiddleJab].ClearCurves();

If you really do have a good reason, you can use the System.Enum class:

string[] CombatMoveNames = System.Enum.GetNames(typeof(CombatMove));

using System.Collections.Generic;
Dictionary<string, AnimationClip> AnimationClipsByName;
AnimationClipsByName["RightMiddleJab"].ClearCurves();
Jon
  • 3.7k
  • 1
  • 14
  • 23