public void CheckIfCorrect() { if (sec.currentBodyPart == currentlyBlue) { if (sec.currentBodyPart != 7) { bodyParts[currentlyBlue].transform.SetParent(bodyParts[currentlyBlue].GetComponent <BodyPartTeleportPosition>().attachTo.transform); bodyParts[currentlyBlue].transform.localPosition = Vector3.zero; bodyParts[currentlyBlue].transform.localRotation = new Quaternion(0, 0, 0, 0); inGameButtons[currentlyBlue].transform.GetChild(0).gameObject.SetActive(false); inGameButtons[currentlyBlue].transform.GetChild(1).gameObject.SetActive(false); sec.UpCount(); } Debug.Log("yeah"); } else { fouten--; if (fouten <= 0) { moestOpnieuwBeginnen = true; fouten = 2; ResetRobot(); } foutenText.text = moestOpnieuwBeginnen ? (fouten > 1 ? "Je moest opnieuw beginnen, je hebt nog " + fouten + " fouten over" : "Je moest opnieuw beginnen, je hebt nog " + fouten + " fout over") : (fouten > 1 ? "Je hebt nog " + fouten + " fouten over" : "Je hebt nog " + fouten + " fout over"); Debug.Log("no"); } }
public void OnFinish() { Debug.Log("Finished :" + this.name); seq.UpCount(); Destroy(col.transform.GetComponent <Rigidbody>()); if (pick.currentSelected.gameObject == col.gameObject) { pick.currentSelected = null; } pick.ReleaseObject(); hand.SpawnCorrectParticles(spawnParticlesHere == null ? transform.position : spawnParticlesHere.position); correctObject.transform.SetParent(snapToThis != null ? snapToThis.transform : parentObject.transform); for (int i = 0; i < pick.transform.childCount; i++) { if (pick.transform.GetChild(i).GetComponent <PickableObject>() != null) { Destroy(pick.transform.GetChild(i).GetComponent <PickableObject>()); } } correctObject.transform.localPosition = Vector3.zero; correctObject.transform.rotation = new Quaternion(0, 0, 0, 0); Destroy(correctObject.transform.GetChild(0).gameObject.GetComponent <PickableObject>()); Destroy(correctObject.transform.GetChild(0).gameObject.GetComponent <BoxCollider>()); Destroy(correctObject.GetComponent <Rigidbody>()); Destroy(GetComponent <BoxCollider>()); Destroy(correctObject.GetComponent <Collider>()); hand.DestroyParticle(); try { Destroy(canAttachParticle); }catch { } Destroy(this); return; }