Пример #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Food")
     {
         print("Ada Daging");
         varHunger += 20;
         Destroy(other.gameObject);
     }
     else if (other.gameObject.tag == "Stale")
     {
         print("Ada Daging Busuk");
         varHunger -= 20;
         Destroy(other.gameObject);
     }
     else if (other.gameObject.tag == "Coin")
     {
         print("Dapat coin");
         coinSystem.AddCoin(10);
         Destroy(other.gameObject);
     }
     else if (other.gameObject.tag == "Book")
     {
         print("Jumpa Buku");
         bookManager.txtPencet.gameObject.SetActive(true);
     }
 }
Пример #2
0
    // Start is called before the first frame update
    IEnumerator Start()
    {
        star = GetComponentInChildren <Star>();
        do
        {
            yield return(new WaitForSeconds(5));

            cs = FindObjectOfType <CoinSystem>();
            star.Launch();
            cs.AddCoin(4);
        } while (looping == true);
    }
Пример #3
0
    void ReachedToVictory()
    {
        enemyTankDeathCount++;
        if (enemyTankDeathCount == numberOfEnemyTeam && !isOver)
        {
            controlAIText.SetActive(false);
            gameOverPanel.SetActive(true);
            resultText.text = "Victory!";

            coinSystem.AddCoin(300);

            isOver = true;
        }
    }