Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void OnCollisionEnter2D(Collision2D collision)
- {
- if (health == 0)
- {
- Destroy(gameObject);
- }
- else
- {
- health = health - 1;
- gameObject.layer = 3;
- for(int = 0; i < iFrames; i++)
- {
- gameObject.GetComponentInChildren<Renderer>().enabled = false;
- yield return new WaitForSeconds(.5f);
- gameObject.GetComponentInChildren<Renderer>().enabled = true;
- yield return new WaitForSeconds(.5f);
- }
- gameObject.GetComponentInChildren<Renderer>().enabled = true;
- gameObject.layer = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment