Guest User

Untitled

a guest
Apr 23rd, 2024
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. private void OnCollisionEnter2D(Collision2D collision)
  2.     {
  3.         if (health == 0)
  4.         {
  5.             Destroy(gameObject);
  6.         }
  7.         else
  8.         {
  9.             health = health - 1;
  10.             gameObject.layer = 3;
  11.             for(int = 0; i < iFrames; i++)
  12.             {
  13.                 gameObject.GetComponentInChildren<Renderer>().enabled = false;
  14.                 yield return new WaitForSeconds(.5f);
  15.                 gameObject.GetComponentInChildren<Renderer>().enabled = true;
  16.                 yield return new WaitForSeconds(.5f);
  17.             }
  18.             gameObject.GetComponentInChildren<Renderer>().enabled = true;
  19.             gameObject.layer = 0;
  20.  
  21.  
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment