private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1) { //if (S != this) // Destroy(gameObject); //S = this; enemiesInLevel = new List <Enemy>(FindObjectsOfType <Enemy>()); Kobi k = FindObjectOfType <Kobi>(); Rigidbody r = k.GetComponent <Rigidbody>(); if (r.constraints == RigidbodyConstraints.None) { k.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation & RigidbodyConstraints.FreezePositionZ; } }
private void OnCollisionEnter(Collision collision) { contact = true; Kobi kobi = gameObject.GetComponent <Kobi>(); if (collision.gameObject.GetComponent <Enemy>()) { if (!kobi.dead) { kobi.dead = true; GameManager.S.PlayerChangedState(kobi.dead); } } }