Ejemplo n.º 1
0
    void OnGUI()
    {
        if (selectedUnits.Count == 1 && selectedUnits[0] != null)
        {
            var unit = selectedUnits[0].GetComponent <Entity>();
            if (unit != null && unit.sellable &&
                GUI.Button(new Rect(450, 0, 64, 24), "Sell"))
            {
                ComSat.IssueSell(unit);
            }
        }

        if (marqueeActive)
        {
            GUI.color = overlayColour;
            GUI.DrawTexture(marqueeRect, marqueeGraphics);
        }
        for (int i = 0; i < unitGroups.Length; ++i)
        {
            if (unitGroups[i] == null)
            {
                continue;
            }
            foreach (var unit in unitGroups[i])
            {
                if (unit == null)
                {
                    continue;
                }
                if (!selectedUnits.Exists(other => unit == other))
                {
                    continue;
                }
                Vector3 screenPos = Camera.main.WorldToScreenPoint(unit.transform.position);
                GUI.Label(new Rect(screenPos.x, Screen.height - screenPos.y, 64, 24), i.ToString());
            }
        }

        if (ComSat.localTeam != -1)
        {
            GUI.color = Color.white;
            if (resourceMan)
            {
                GUI.Label(new Rect(0, 0, 128, 24), "Metal: " + resourceMan.teamResources[ComSat.localTeam].Metal);
                GUI.Label(new Rect(128, 0, 128, 24), "Magic Smoke: " + resourceMan.teamResources[ComSat.localTeam].MagicSmoke);
            }
            if (powerMan != null)
            {
                var powerUse    = powerMan.teamPowerUse[ComSat.localTeam];
                var powerSupply = powerMan.teamPowerSupply[ComSat.localTeam];
                if (powerUse > powerSupply)
                {
                    GUI.color = Color.red;
                }
                GUI.Label(new Rect(256, 0, 256, 24), "Power Usage: " + powerUse + "/" + powerSupply);
                if (powerUse > powerSupply)
                {
                    GUI.color = Color.white;
                }
            }
        }
    }