Example #1
0
    void OnGUI()
    {
        List <KeyCode> KeyList = new List <KeyCode>();

        KeyList.Add(KeyCode.Space);
        KeyList.Add(KeyCode.A);
        KeyList.Add(KeyCode.S);
        KeyList.Add(KeyCode.W);
        KeyList.Add(KeyCode.D);
        foreach (KeyCode tmpKey in KeyList)
        {
            if (Input.GetKey(tmpKey))
            {
                GameStateScript.KeyAction(tmpKey);
            }
        }

        GUI.Box(new Rect(10.0f, 10.0f, 100.0f, 30.0f), "Score: " + score);
        string livesString = "Lives: ";

        for (int i = 0; i < numberOfLives; ++i)
        {
            livesString += "A ";             // These look like little ships :P
        }
        GUI.Box(new Rect(10.0f, Screen.height - 30.0f, 100.0f, 30.0f), livesString);
    }