public void Init(int n) { state = (STATE)Enum.ToObject(typeof(STATE), n); switch (state) { case STATE.KEY: key = this.gameObject.GetComponent <ItemKey> (); key.Init(); Debug.Log("Key Inited"); break; case STATE.NOISY: noisy = this.gameObject.GetComponent <ItemNoisy> (); noisy.Init(); break; case STATE.GARBAGE: garbage = this.gameObject.GetComponent <ItemGarbage> (); garbage.Init(); break; default: Debug.Log("何かがおかしいよ! at Item Init()"); break; } }