Example #1
0
        void DrawWeaponList(WeaponInfo[] weapons)
        {
            float totalWidth = (weapons.Count() * weaponWidth);
            GUILayout.BeginArea(new Rect(Screen.width / 2 - (totalWidth / 2), Screen.height - 100f, totalWidth, 100f));
            GUILayout.BeginHorizontal();
                foreach(WeaponInfo weapon in weapons)
                {
                    GUILayout.BeginVertical();

                    GUILayout.Box(Game.Inst.weaponSet.weapons[(int)weapon.weaponType].UIImage, GUILayout.Width(80f), GUILayout.Height(30f));
                    GUIStyle ammoStyle = new GUIStyle();
                    ammoStyle.normal.textColor = Color.white;
                    GUILayout.Box(weapon.ammo + " / " + weapon.maxAmmo, ammoStyle, GUILayout.Width(100f), GUILayout.Height(30f));
                    GUILayout.Box(weapon.fireRate.ToString(), ammoStyle, GUILayout.Width(100f), GUILayout.Height(30f));
                    var con = new GUIContent();

                    GUILayout.EndVertical();
                }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }