Example #1
0
    void Start()
    {
        /*
         * Get Drink Type
         * Set Labels
         * Set Liquid Color
         */

        pd = GetComponent <PourDetector>();
        LiquidType contents = pd.liqourType;

        TextMeshPro[] labels = GetComponentsInChildren <TextMeshPro>();
        foreach (TextMeshPro textMeshPro in labels)
        {
            textMeshPro.text = contents.ToString("G");
        }
        Color liquidColor = LiquidColour.getLiquidColor(contents) * (1f / 255f);

        liquidColor.a = 1;
        Renderer liquidRenderer = gameObject.GetComponentInChildren <Wobble>().gameObject.GetComponent <Renderer>();

        liquidRenderer.material.SetColor("_Tint", liquidColor);
        liquidRenderer.material.SetColor("_TopColor", liquidColor + new Color(0.1f, 0.1f, 0.1f, 1));
        liquidRenderer.material.SetColor("_FoamColor", liquidColor + new Color(0.1f, 0.1f, 0.1f, 1));
        var particleSystemMainModule = GetComponent <ParticleSystem>().main;

        particleSystemMainModule.startColor = liquidColor;
        position    = transform.position;
        orientation = transform.rotation.eulerAngles;
    }
Example #2
0
    private void Awake()
    {
        int index = 0;

        liqourStrings = new string[Enum.GetNames(typeof(LiquidType)).Length];
        foreach (LiquidType liqour in (LiquidType[])Enum.GetValues(typeof(LiquidType)))
        {
            liqourStrings[index] = liqour.ToString();
            index++;
        }
    }
        public static (Color color, ImageBrush icon) GetColorAndIcon(
            LiquidType?liquidType)
        {
            var ui = Api.Client.UI;

            var colorKey = "LiquidColor" + (liquidType?.ToString() ?? "Empty");
            var color    = ui.GetApplicationResource <Color>(colorKey);

            ImageBrush icon;

            if (liquidType is not null)
            {
                var iconKey = "LiquidIcon" + liquidType.Value;
                icon = ui.GetApplicationResource <ImageBrush>(iconKey);
            }
            else
            {
                icon = null;
            }

            return(color, icon);
        }