Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (m_Lives > 0)
        {
            if (Input.GetKeyUp("tab"))
            {
                if (m_Spawners.Length > 0)
                {
                    m_Spawners [0].Spawn();
                }
            }

            if (Input.GetKeyDown("f1"))
            {
                m_HUD.HelpOn();
            }
            if (Input.GetKeyUp("f1"))
            {
                m_HUD.HelpOff();
            }

            if (m_Player.M_health <= 0)
            {
                m_Timer -= Time.deltaTime;
                if (m_Timer < 0.0f)
                {
                    m_Lives -= 1;
                    m_Player.Reset();
                    m_Timer = m_Respawn;
                }
            }
        }
        else
        {
            if (m_HighScores.CheckScore(m_Score) && m_bHSUpdated == false)
            {
                if (m_Values != null)
                {
                    m_HighScores.NewScore(m_Values.M_Username, m_Score);
                }
                M_HighScores.WriteScores();
                m_bHighScore = true;
                m_bHSUpdated = true;
            }

            if (Input.GetKeyUp(KeyCode.Return))
            {
                Restart();
            }
        }

        if (Input.GetKeyUp("escape"))
        {
            //Do pause menu logic
            Application.LoadLevel("MainMenu");
        }
    }