I have the following base class
public abstract class Character : MonoBehaviour
{
protected abstract Enum CurrentState
{
get;
set;
}
}
and the following child class
public class Player : Character
{
protected override Enum CurrentState
{
get
{
return (State)_anim.GetInteger("State");
}
set
{
_anim.SetInteger("State", Convert.ToInt32(value));
}
}
private enum State
{
IDLE = 0,
WALK = 1,
JUMP = 2,
FALL = 3,
CLIMB = 4,
LOOKING_DOWN = 5,
NPC = 6,
IMPATIENT = 7,
LOOKING_UP = 8,
STUCK = 9,
}
void FixedUpdate()
{
if (CurrentState == State.CLIMB)
{
}
}
}
The line
if (CurrentState == State.CLIMB)
yields the following error: Operator '==' cannot be applied to operands of type 'Enum' and 'Player.State'
Any help? The getter works fine. So maybe I need to do a cast conversion in the set accessor? I'm not really sure...I'm kind of new to this...Any help would be more than appreciated.