예제 #1
0
 private void EventNodeClick()
 {
     ns.nextLevel();
     EventUICanvas.alpha = 0;
     EventUICanvas.gameObject.SetActive(true);
     StartCoroutine(EventUIFadeIn());
 }
예제 #2
0
 private void ShopNodeClick()
 {
     ns.nextLevel();
     ShopUICanvas.alpha = 0;
     ShopUICanvas.gameObject.SetActive(true);
     StartCoroutine(ShopUIFadeIn());
 }
예제 #3
0
 private void RestNodeClick()
 {
     ns.nextLevel();
     RestUICanvas.alpha = 0;
     RestUICanvas.gameObject.SetActive(true);
     ConsistentObj.setHealth(10);
     StartCoroutine(RestUIFadeIn());
 }
예제 #4
0
    private void CheckAnswer(int i)
    {
        if (!disable)
        {
            if (i == correctAnswer)
            {
                //correct
                enemyHealth     -= 5;
                EnemyHealth.text = "Enemy:\n" + enemyHealth.ToString();
            }

            else
            {
                //wrong
                ConsistentObj.setHealth(ConsistentObj.getHealth() - 5);
                Health.text = "Health:\n" + ConsistentObj.getHealth().ToString();
            }

            if (ConsistentObj.getHealth() <= 0)
            {
                disable = true;
                //gameover
                GameOverLabel.SetActive(true);
                StartCoroutine(GameOverFade());
            }
            else if (enemyHealth <= 0)
            {
                disable = true;
                //win
                VictoryLabel.SetActive(true);
                ns.nextLevel();
                StartCoroutine(VictoryFade());
            }
            else
            {
                GenerateQuestion();
            }
        }
    }