public void Onclick(int button) // -1 or 0 or +1 { int total = 0; List <Ball> BallsSC = new List <Ball> { }; foreach (Transform childTransform in Balls.transform) { BallsSC.Add(childTransform.GetComponent <Ball>()); } foreach (Ball Ball in BallsSC) { total += Ball.GetNumber(); } //答え合わせ if ((button < 0 && total < 0) || (button > 0 && total > 0) || (button == 0 && total == 0) ) { //正解 Correct.PlayOneShot(Correct.clip); //SE OBJ_ReMaining.ReduseRemaining(); scoreCount.incrementScore(); foreach (Ball Ball in BallsSC) { Ball.SetText(); } } else { //不正解 Miss.PlayOneShot(Miss.clip); //SE StartCoroutine(MissWait()); } }