Esempio n. 1
0
 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));
     }
 }
Esempio n. 2
0
 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;
     }
 }