void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("Player")) { statManager.kurangNyawa(); Instantiate(playerhit); Destroy(this.gameObject); } if (other.gameObject.CompareTag("Projectile")) { //csv statManager.csvManager.AddData(soalManager.getSoalText(), soalManager.getJawabanText(), carriedAnswer.ToString()); if (soalManager.angkaJawab == carriedAnswer) { statManager.tambahScore(); soalManager.callBuatSoal(); Destroy(other.gameObject); Destroy(this.gameObject); } else { statManager.kurangScore(); soalManager.callBuatSoal(); Destroy(other.gameObject); Destroy(this.gameObject); //TODO : hapus baris ini, kalo pas salah, musuhnya tetep ada } Instantiate(hitbyprojectile); } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { Instantiate(playerhit); statManager.kurangNyawa(); } }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("Player")) { statManager.kurangNyawa(); Instantiate(playerhit); Destroy(this.gameObject); } if (other.gameObject.CompareTag("Destroyer")) { Destroy(this.gameObject); } }