void ChangeState(int newState) { Time.timeScale = 1; anim.enabled = true; float height = 1; switch (newState) { case AppConst.MARIO_SMALL: height = 1; break; case AppConst.MARIO_BIG: height = 2; break; case AppConst.MARIO_FIRE: height = 2; break; default: break; } spriteRenderer.color = Color.white; (col as BoxCollider2D).size = new Vector2((col as BoxCollider2D).size.x, height); (col as BoxCollider2D).offset = new Vector2(0, height / 2); EventManager.ExecuteEvent <int>("MarioChangeState", newState); //anim.runtimeAnimatorController = marioControllers[newState]; Treasure.OnMarioStateChange(newState); }