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);
31 //StartCoroutine("GetInvincible");
36 /**IEnumerator GetInvincible()
39 Physics2D.IgnoreLayerCollision(7, 8, true);
40 for (int i = 0; i < 4; i++)
42 spriteRenderer.enabled = false;
43 yield return new WaitForSeconds(flashingTime);
44 spriteRenderer.enabled = true;
45 yield return new WaitForSeconds(flashingTime);
47 Physics2D.IgnoreLayerCollision(7, 8, false);
48 spriteRenderer.enabled = true;