Bind Enum to Control

May be it’s a function of ActionScript/UnrealScript. In C/C++ we can create a table with function pointers and call it to perform the desired action:



enum class Action { Walk, Run, Jump, Hop, Skip, Strafe, . . . };
:
:
struct _MyActionTable
{
    Action theAction;
    void (*theFunction)(AActor&);
}
:
:
void WalkFunction( AActor& theActor )
{
    if(theActor.IsAlive())
        theActor.Walk();
}
:
:
TArray<_MyActionTable> ActionList =
{
    { Walk, &WalkFunction },
    { Run, &RunFunction },
    { Jump, &JumpFunction },
    :
};

void DoAction(Action action, AActor& actor)
{
    for(int x = 0; x < ActionList.Num(); x++)
    {
        if(action == ActionList[x].theAction)
        {
            (*ActionList[x].theFunction)( actor );
            return;
        }
    }
}


The syntax may be wrong but the concept is the same: keep a table of keys to compare against, and call the associated function when a match occurs. In addition to primitive structures like this there are classes, which allows for sleeker (and slicker) architectures. Who’s running? A horse? A camel? A man? A hovercraft?

Anyway, thank you for taking the time to explain (and confirm) the use of enum data types within blueprints. At least now I can proceed with some confidence in knowing that I’m not duplicating work that’s already been done.