Esempio n. 1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == (black ? "EnemyW" : "EnemyB"))
     {
         camScript.PlayExplosion();
         camScript.TriggerShake(0.7f, 5f);
         GetComponent <SpriteRenderer>().enabled   = false;
         GetComponent <CircleCollider2D>().enabled = false;
         Invoke("Reset", 2f);
     }
     if (collision.gameObject.tag == (black ? "EnemyB" : "EnemyW"))
     {
         Physics2D.IgnoreCollision(collision.gameObject.GetComponent <Collider2D>(), GetComponent <Collider2D>());
     }
 }
Esempio n. 2
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         camScript.TriggerShake(0.25f, 0.75f);
         camScript.PlayFlip();
         scoreScript.Flip();
         background.color = background.color == Color.black ? Color.white : Color.black;
         collision.gameObject.GetComponent <PlayerScript>().Flip();
         Destroy(gameObject);
     }
     else if (collision.gameObject.tag == "Wall" || collision.gameObject.tag == "EnemyB" || collision.gameObject.tag == "EnemyW")
     {
         Physics2D.IgnoreCollision(collision.gameObject.GetComponent <Collider2D>(), gameObject.GetComponent <Collider2D>());
     }
 }