I get error: The type ‘int’ does not have a visible constructor that matches the argument list ‘(States)’. But I don’t see the error - it’s explicit conversion from enum to int.
enum States
{
IDLE, FALLING, FLYING
}
var listStates : State[] = new State[NUMBER_OF_STATES];
function initialize() : void
{
//init list of states
listStates[int(States.IDLE)] = new IdleState(); // ERROR
listStates[int(States.FALLING)] = new FallingState(); // ERROR
listStates[int(States.FLYING)] = new FlyingState(); // ERROR
}
Why this error message?