Beispiel #1
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.CompareTag("Cactus"))
     {
         //create a class that manages sprites (SpriteManager), make a static class object internally (see AccountManager as example), then use this to determine what the player death sprite should be upon game over
         spriteRenderer.sprite = deathSkins[spriteHandler.GetActiveSkinIndex()];
         rb.velocity           = new Vector2(0, 0);
         FindObjectOfType <GameStatus>().SetGameOver(true);
         menuLoader.LoadGameOver();
     }
     else if (other.gameObject.CompareTag("Coin"))
     {
         FindObjectOfType <GameStatus>().AddToScore();
         Destroy(other.gameObject);
     }
 }