Beispiel #1
0
    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);
        }
    }
Beispiel #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         Instantiate(playerhit);
         statManager.kurangNyawa();
     }
 }
Beispiel #3
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            statManager.kurangNyawa();
            Instantiate(playerhit);
            Destroy(this.gameObject);
        }

        if (other.gameObject.CompareTag("Destroyer"))
        {
            Destroy(this.gameObject);
        }
    }