StretchyTanks.StretchyTanks.OnGUI C# (CSharp) Method

OnGUI() public method

public OnGUI ( ) : void
return void
        void OnGUI()
        {
            if (GUIon == true && GUIdisabled == false)
            {
                Vector2 screenPoint = Camera.main.WorldToScreenPoint(transform.position);
                Rect posMass = new Rect(screenPoint.x - 88f, Screen.height - screenPoint.y, 176f, 35f);
                Rect posRes = new Rect(screenPoint.x - 88f, Screen.height - screenPoint.y - 35, 176f, 35f);
                Rect posSize = new Rect(screenPoint.x - 88f, Screen.height - screenPoint.y + 35, 176f, 35f);
                GUIStyle styMass = new GUIStyle();
                GUIStyle styRes = new GUIStyle();
                styMass.alignment = TextAnchor.MiddleCenter;
                styRes.alignment = TextAnchor.MiddleCenter;
                styMass.normal.textColor = Color.black;
                switch (tankType)
                {
                    case TANK_MIXED:
                        styRes.normal.textColor = Color.blue;
                        break;
                    case TANK_LIQUID_FUEL:
                        styRes.normal.textColor = Color.green;
                        break;
                    case TANK_MONOPROP:
                        styRes.normal.textColor = Color.yellow;
                        break;
                    case TANK_OXIDIZER:
                        styRes.normal.textColor = Color.cyan;
                        break;
                    case TANK_SOLID:
                        styRes.normal.textColor = Color.red;
                        break;
                }
                if (tankType != TANK_STRUCTURAL)
                {
                    GUI.Label(posRes, getResourceNames(), styRes);
                    GUI.Label(posMass, "Total Mass: " + Math.Round(part.mass + part.GetResourceMass(), 3) + " tons\nDry Mass: " + part.mass + " tons", styMass);
                }
                else
                {
                    GUI.Label(posRes, "Structural Fuselage", styRes);
                    GUI.Label(posMass, "Mass: " + part.mass + " tons", styMass);
                }
                GUI.Label(posSize, "Size: " + getSizeText(), styRes);
            }
        }