Beispiel #1
0
    void OnGUI()
    {
        //show mags
        if (weaponData.magazines > 0)
        {
            GUI.Label(new Rect(50, Screen.height - 90, 100, 40), new GUIContent(weaponData.magazines + " Magazines"));
        }
        else if (weaponData.magazines == 1)
        {
            GUI.Label(new Rect(50, Screen.height - 90, 100, 40), new GUIContent(weaponData.magazines + " Magazine"));
        }
        else
        {
            GUI.Label(new Rect(50, Screen.height - 90, 100, 40), new GUIContent("-- Magazines"));
        }


        if (!weaponData.GetReloading())
        {
            //show bullets
            if (weaponData.GetBullets() > 0)
            {
                GUI.Label(new Rect(50, Screen.height - 70, 100, 20), new GUIContent(weaponData.GetBullets() + " Bullets"));
            }
            else if (weaponData.GetBullets() == 1)
            {
                GUI.Label(new Rect(50, Screen.height - 70, 100, 20), new GUIContent(weaponData.GetBullets() + " Bullet"));
            }
            else
            {
                GUI.Label(new Rect(50, Screen.height - 70, 100, 20), new GUIContent("-- Bullet"));
            }
        }
        else
        {
            //show cooldown
            if (weaponData.magazines != -1)
            {
                GUI.Label(new Rect(50, Screen.height - 70, 100, 20), new GUIContent("RELOADING " + weaponData.GetReloadingTimer() + " seconds"));
            }
            else
            {
                GUI.Label(new Rect(50, Screen.height - 70, 100, 20), new GUIContent("COOLDOWN " + weaponData.GetReloadingTimer() + " seconds"));
            }
        }
    }