예제 #1
0
    void Event(eUIEvent evt)
    {
        switch (evt)
        {
        case eUIEvent.destroedShape:
            score++;
            scoreTxt.GetComponent <Text>().text = "Score: " + score.ToString();
            scoreTxt.GetComponent <Animation>().Play("ScoreAnimation");
            if (score >= winScore)
            {
                endGameTxt.SetActive(true);
                restBtn.SetActive(true);
                endGameTxt.GetComponent <Text>().text = "YOU WON";
                Time.timeScale = 0;
            }
            break;

        case eUIEvent.lostShape:
            lost--;
            healthPointsTxt.GetComponent <Text>().text = lost.ToString();
            if (lost <= 0)
            {
                endGameTxt.SetActive(true);
                restBtn.SetActive(true);
                endGameTxt.GetComponent <Text>().text = "YOU LOSE";
                Time.timeScale = 0;
            }
            break;
        }
    }
예제 #2
0
 static public void EVENT(eUIEvent evt)
 {
     try
     {
         S.Event(evt);
     }
     catch (System.NullReferenceException nre)
     {
         Debug.LogError("ScoreManager.EVENT(): called while S=null.\n" + nre);
     }
 }