void OnTriggerStay2D(Collider2D other) { if (other.gameObject.name == "LeftHit") { bc = other.transform.parent.gameObject.GetComponent <BoxController>(); {//resetこれを追加しないと途中でboxSizeCntに加算されて0にならなくなるため if (bc.SetNo() != noNow[0] && bc.SetNo() != noNow[1] && bc.SetNo() != noNow[2] && bc.SetNo() != noNow[3] && bc.SetNo() != noNow[4] && bc.SetNo() != noNow[5] && bc.SetNo() != noNow[6] && bc.SetNo() != noNow[7]) { //番号を読み込む時に、かぶっていなければ if (noNow[0] == 0) //順番に番号とサイズの大きさを記憶 { noNow[0] = bc.SetNo(); boxSize[0] = bc.SetBoxSize(); bcClone[0] = bc; } else if (noNow[1] == 0) { noNow[1] = bc.SetNo(); boxSize[1] = bc.SetBoxSize(); bcClone[1] = bc; } else if (noNow[2] == 0) { noNow[2] = bc.SetNo(); boxSize[2] = bc.SetBoxSize(); bcClone[2] = bc; } else if (noNow[3] == 0) { noNow[3] = bc.SetNo(); boxSize[3] = bc.SetBoxSize(); bcClone[3] = bc; } else if (noNow[4] == 0) { noNow[4] = bc.SetNo(); boxSize[4] = bc.SetBoxSize(); bcClone[4] = bc; } else if (noNow[5] == 0) { noNow[5] = bc.SetNo(); boxSize[5] = bc.SetBoxSize(); bcClone[5] = bc; } else if (noNow[6] == 0) { noNow[6] = bc.SetNo(); boxSize[6] = bc.SetBoxSize(); bcClone[6] = bc; } else if (noNow[7] == 0) { noNow[7] = bc.SetNo(); boxSize[7] = bc.SetBoxSize(); bcClone[7] = bc; } bc.compTrue(); } } } }