private void OnCollisionEnter(Collision other) { nutSpawner.DecreaseNutCount(); audioPlaying = true; score++; //print(score); hingeAudioSource.PlayOneShot(nutCrunch); if (other.gameObject.CompareTag("almond")) { tempint = 0; } else if (other.gameObject.CompareTag("cashew")) { tempint = 1; } else if (other.gameObject.CompareTag("pecan")) { tempint = 2; } scoreNutSpawner.SpawnNut(tempint); Destroy(other.gameObject); print(other.gameObject); //scoreMovement.UpdateScore(score); if (!cameraShake.corIsRunning) { StartCoroutine(cameraShake.Shake(cameraShake.duration, cameraShake.magnitude)); } }
private void FixedUpdate() { if (thisNut.transform.localPosition.x <= nutLimit.x) { //print("we are destroying"); nutSpawner.DecreaseNutCount(); Destroy(thisNut); } else { //print(thisNut.transform.localPosition); thisNut.transform.localPosition = thisNut.transform.localPosition + nutVector; } }