Esempio n. 1
0
 void HitBoxHit(int carriedAnswer)      //Pass weakspotnya hit --> do something
 {
     Instantiate(hitbyprojectile);
     if (soalManager.angkaJawab == carriedAnswer)
     {
         statManager.tambahScore();
         soalManager.callBuatSoal();
         nyawaBoss--;
         statManager.refreshUInyawaBoss(nyawaBoss);
         RegenJawaban();
         if (nyawaBoss <= 0)
         {
             statManager.tambahScore(carriedScore);
             statManager.enableUInyawaBoss(false);
             if (endlessModeBoss)
             {
                 spawnManager.changeBossTimeState();
             }
             else
             {
                 statManager.loadNextLevel();                      //load level selanjutnya
             }
             Destroy(this.gameObject);
         }
     }
     else
     {
         statManager.kurangScore();
         soalManager.callBuatSoal();
         RegenJawaban();
     }
 }
Esempio n. 2
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);
        }
    }