1 using System.Collections;
2 using System.Collections.Generic;
5 public class BossCollision : MonoBehaviour
9 SpriteRenderer spriteRenderer;
11 public float flashingTime;
13 public bool invulnerable;
17 boss = GetComponent<Boss>();
18 spriteRenderer = GetComponent<SpriteRenderer>();
21 //Bei Beruehrung mit der Schere wird die Gesundheit um 1 verringert
22 public void OnCollisionEnter2D(Collision2D collision)
24 if (boss.bossfight && !invulnerable)
26 if (collision.gameObject.CompareTag("Bullet"))
29 Destroy(collision.gameObject);
30 //StartCoroutine("GetInvincible");
35 /**IEnumerator GetInvincible()
38 Physics2D.IgnoreLayerCollision(7, 8, true);
39 for (int i = 0; i < 4; i++)
41 spriteRenderer.enabled = false;
42 yield return new WaitForSeconds(flashingTime);
43 spriteRenderer.enabled = true;
44 yield return new WaitForSeconds(flashingTime);
46 Physics2D.IgnoreLayerCollision(7, 8, false);
47 spriteRenderer.enabled = true;