void OnCollisionEnter(Collision col) { //test si assiète complète sinon pas acceptée if (col.gameObject.GetComponent <plate>() != null) { recipiePrice = 0; List <Transform> list = col.gameObject.GetComponent <plate>().getList(); bool result = true; for (int i = 0; i < recipie.Length; i++) { //Debug.Log("recipie :" + recipie[i].name + "// plate :" + list[i].GetComponent<AbstractFood>().name); if (recipie[i].cookState != list[i].GetComponent <AbstractFood>().cookState || recipie[i].sliceState != list[i].GetComponent <AbstractFood>().sliceState || recipie[i].name.Equals(list[i].GetComponent <AbstractFood>().name)) { recipiePrice -= list[i].GetComponent <AbstractFood>().getPrice(); result = false; } else { recipiePrice += list[i].GetComponent <AbstractFood>().getPrice(); } } if (result) { if (source != null && win != null) { source.PlayOneShot(win); } } else { if (source != null && win != null) { source.PlayOneShot(fail); } } mc.setMoney(mc.getMoney() + recipiePrice); col.gameObject.GetComponent <plate>().destroyList(); Destroy(col.gameObject); } }