Esempio n. 1
0
    /// <summary>
    /// Displays updated lighting unit information.
    /// </summary>
    public void LightingUnitUpdated()
    {
        List <LightingUnit> bulbs = lightingUnitHandler.GetComponent <LightingUnitPlacementHandler>().LightBulbs;
        int hits = 0;

        for (int i = 0; i < bulbs.Count; i++)
        {
            hits += bulbs[i].hits;
        }

        float covering = ((float)hits / (float)spatialProcessing.GetComponent <SpatialObserverHandler>().CombinedMesh.triangles.Length) * 100;

        string desc = (int)covering + " % of the room is strongly illuminated (red colored)";

        if (bulbs.Where(b => b.unitType == "Type A").Count() > 0)
        {
            desc += "\n - " + bulbs.Where(b => b.unitType == "Type A").Count() + " Type A, energy consumption of " + (LightingUnit.GetLightingUnitTypeValues("Type A")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type A")[0] * LightingUnit.GetLightingUnitTypeValues("Type A")[0])).ToString("F1") + " with an estimated durability of " + LightingUnit.GetLightingUnitTypeValues("Type A")[1] + " years";
        }

        if (bulbs.Where(b => b.unitType == "Type B").Count() > 0)
        {
            desc += "\n - " + bulbs.Where(b => b.unitType == "Type B").Count() + " Type B, energy consumption of " + (LightingUnit.GetLightingUnitTypeValues("Type B")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type B")[0] * LightingUnit.GetLightingUnitTypeValues("Type B")[0])).ToString("F1") + " with an estimated durability of " + LightingUnit.GetLightingUnitTypeValues("Type B")[1] + " years";
        }

        if (bulbs.Where(b => b.unitType == "Type C").Count() > 0)
        {
            desc += "\n - " + bulbs.Where(b => b.unitType == "Type C").Count() + " Type C, energy consumption of " + (LightingUnit.GetLightingUnitTypeValues("Type C")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type C")[0] * LightingUnit.GetLightingUnitTypeValues("Type C")[0])).ToString("F1") + " with an estimated durability of " + LightingUnit.GetLightingUnitTypeValues("Type C")[1] + " years";
        }

        desc += "\nTotal energy consumption per illuminated unit: " + (((LightingUnit.GetLightingUnitTypeValues("Type A")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type A")[0] * LightingUnit.GetLightingUnitTypeValues("Type A")[0])) * bulbs.Where(b => b.unitType == "Type A").Count()) + ((LightingUnit.GetLightingUnitTypeValues("Type B")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type B")[0] * LightingUnit.GetLightingUnitTypeValues("Type B")[0])) * bulbs.Where(b => b.unitType == "Type B").Count()) + ((LightingUnit.GetLightingUnitTypeValues("Type C")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type C")[0] * LightingUnit.GetLightingUnitTypeValues("Type C")[0])) * bulbs.Where(b => b.unitType == "Type C").Count())).ToString("F1");
        desc += "\nAir tap on light bulbs for configuration!";

        SetPanelText("Eco Feedback", desc);
    }
Esempio n. 2
0
    /// <summary>
    /// Handles the lighting recommendation completion event.
    /// </summary>
    /// <param name="source"></param>
    /// <param name="args"></param>
    public void LightingRecommendationCompletedEventHandler(object source, System.EventArgs args)
    {
        string desc = (int)lightingUnitHandler.GetComponent <LightingUnitPlacementHandler>().Covering + " % of the room is strongly illuminated (red colored)";

        textPanel.SetActive(false);

        List <LightingUnit> bulbs = lightingUnitHandler.GetComponent <LightingUnitPlacementHandler>().LightBulbs;

        if (bulbs.Where(b => b.unitType == "Type A").Count() > 0)
        {
            desc += "\n - " + bulbs.Where(b => b.unitType == "Type A").Count() + " Type A, energy consumption of " + (LightingUnit.GetLightingUnitTypeValues("Type A")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type A")[0] * LightingUnit.GetLightingUnitTypeValues("Type A")[0])).ToString("F1") + " with an estimated durability of " + LightingUnit.GetLightingUnitTypeValues("Type A")[1] + " years";
        }

        if (bulbs.Where(b => b.unitType == "Type B").Count() > 0)
        {
            desc += "\n - " + bulbs.Where(b => b.unitType == "Type B").Count() + " Type B, energy consumption of " + (LightingUnit.GetLightingUnitTypeValues("Type B")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type B")[0] * LightingUnit.GetLightingUnitTypeValues("Type B")[0])).ToString("F1") + " with an estimated durability of " + LightingUnit.GetLightingUnitTypeValues("Type B")[1] + " years";
        }

        if (bulbs.Where(b => b.unitType == "Type C").Count() > 0)
        {
            desc += "\n - " + bulbs.Where(b => b.unitType == "Type C").Count() + " Type C, energy consumption of " + (LightingUnit.GetLightingUnitTypeValues("Type C")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type C")[0] * LightingUnit.GetLightingUnitTypeValues("Type C")[0])).ToString("F1") + " with an estimated durability of " + LightingUnit.GetLightingUnitTypeValues("Type C")[1] + " years";
        }

        desc += "\nTotal energy consumption per illuminated unit: " + (((LightingUnit.GetLightingUnitTypeValues("Type A")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type A")[0] * LightingUnit.GetLightingUnitTypeValues("Type A")[0])) * bulbs.Where(b => b.unitType == "Type A").Count()) + ((LightingUnit.GetLightingUnitTypeValues("Type B")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type B")[0] * LightingUnit.GetLightingUnitTypeValues("Type B")[0])) * bulbs.Where(b => b.unitType == "Type B").Count()) + ((LightingUnit.GetLightingUnitTypeValues("Type C")[2] / (Mathf.PI * LightingUnit.GetLightingUnitTypeValues("Type C")[0] * LightingUnit.GetLightingUnitTypeValues("Type C")[0])) * bulbs.Where(b => b.unitType == "Type C").Count())).ToString("F1");

        desc += "\nAir tap on light bulbs for configuration!";

        SetPanelText("Eco Feedback", desc);

        textPanel.SetActive(true);
        textPanel.GetComponentInParent <SolverHandler>().UpdateSolvers = false;
    }