private void OnTriggerEnter(Collider other) { Smashable smashableObject = other.GetComponent <Smashable>(); if (smashableObject.tipe == "Nut") { ScoreManager.instance.MinisScore(); } Destroy(other.gameObject); }
void CollideWith(Collider2D other) { if (other == null) { return; } TouchHazard hazard = other.GetComponent <TouchHazard>(); if (hazard) { if (jumpState == JumpState.Dash) { Destroy(hazard.gameObject); } else { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } } Smashable smashable = other.GetComponent <Smashable>(); if (smashable) { if (jumpState == JumpState.Dash) { Destroy(smashable.gameObject); } } Seeker seeker = other.GetComponent <Seeker>(); if (seeker) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } }