示例#1
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            StartGame();
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            PauseGame();
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            ReplayGame();
            Time.timeScale = 1.0f;
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            ExitGame();
        }
        if (m_playerLogic.IsDead())
        {
            m_pause.text   = "You lose!";
            m_hint.text    = "Press \"R\" to restart game\nPress \"Esc\" to quit game";
            Time.timeScale = 0f;
        }
        if (m_enemyLogic.GetHealth() <= 0)
        {
            m_pause.text   = "You win!";
            m_hint.text    = "Press \"R\" to restart game\nPress \"Esc\" to quit game";
            Time.timeScale = 0f;
        }
    }
 void Update()
 {
     HP            = m_enemyLogic.GetHealth();
     HPStrip.value = HP;
 }