Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        // Average heat from all weapons (although we only have one right now)

        if (playerUnit == null)
        {
            return;
        }

        WeaponSlot[] wss  = playerUnit.GetComponentsInChildren <WeaponSlot>();
        float        heat = 0;

        foreach (WeaponSlot ws in wss)
        {
            heat += ws.Heat;
        }
        heat /= wss.Length;

        text.text        = "Heat: " + Mathf.CeilToInt(heat * 100);
        image.fillAmount = heat;
    }