// Update is called once per frame void Update() { for (int i = 1; i <= 3; i++) { if (Input.GetKeyDown(i.ToString())) { State = (ENPCState)i; } } switch (State) { case ENPCState.IDLE: DoIdleStuff(); break; case ENPCState.FOLLOW: DoFollowStuff(); break; default: break; } }
// Use this for initialization void Start() { State = ENPCState.IDLE; }