Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.CompareTag("PickUp"))
     {
         this.EquipItem(col.gameObject.GetComponent <SpriteRenderer>().sprite, col.gameObject.GetComponent <SwordScript>().damage);
         GameObject swipeUpTutorial = GameObject.Find("SwipeUpTutorial(Clone)");
         Destroy(swipeUpTutorial);
         Destroy(col.gameObject);
     }
     else if (col.gameObject.CompareTag("DeathTrigger") && !isDead)
     {
         DeathAnimation();
         Invoke("Resurrect", 3);
     }
     else if (col.transform.CompareTag("Platform"))
     {
         transform.parent = col.transform;
     }
     else if (col.gameObject.CompareTag("Coin"))
     {
         coins++;
         coinsInLevel++;
         audioSource.PlayOneShot(coinPickUp, 1f);
         coinController.UpdateCoinsUI(coins);
         Destroy(col.gameObject);
         PlayerPrefs.SetInt("Coins", coins);
         PlayerPrefs.Save();
     }
 }