private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.GetComponent <Item>() && collision.gameObject.GetComponent <Item>().type == Item.ItemType.LOG) { ps.addScore(); fireHP += 10; Destroy(collision.gameObject); } else if (collision.gameObject.GetComponent <Item>() && collision.gameObject.GetComponent <Item>().type == Item.ItemType.COAL) { //The literal worst way to add points but crunch baby. ps.addScore(); ps.addScore(); fireHP += 20; Destroy(collision.gameObject); } else if (collision.gameObject.GetComponent <ProjectileController>()) { ps.addScore(); fireHP += 10; Destroy(collision.gameObject); } if (collision.gameObject.GetComponent <EnemyController>()) { fireHP -= 5; collision.gameObject.GetComponent <EnemyController>().takeDamage(999); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.GetComponent <EnemyController>()) { Debug.Log("Entered"); collision.GetComponent <EnemyController>().takeDamage(10); ps.addScore(); pierce--; if (pierce <= 0) { Destroy(this.gameObject); } } }