Exemple #1
0
        public Material GetMaterial(ColorMeaning meaning, InteractionField fieldType)
        {
            if (meaning == ColorMeaning.Positive || meaning == ColorMeaning.Negative)
            {
                FieldColors colorSet = GetFieldColors(fieldType);
                if (meaning == ColorMeaning.Positive)
                {
                    if (!colorSet.positiveMaterial)
                    {
                        colorSet.positiveMaterial       = Instantiate(baseMaterial);
                        colorSet.positiveMaterial.color = colorSet.positiveColor;
                    }

                    return(colorSet.positiveMaterial);
                }
                if (meaning == ColorMeaning.Negative)
                {
                    if (!colorSet.negativeMaterial)
                    {
                        colorSet.negativeMaterial       = Instantiate(baseMaterial);
                        colorSet.negativeMaterial.color = colorSet.negativeColor;
                    }

                    return(colorSet.negativeMaterial);
                }
            }

            if (!materialDict.ContainsKey(meaning) || !materialDict[meaning])
            {
                materialDict[meaning]       = Instantiate(baseMaterial);
                materialDict[meaning].color = GetColor(meaning, fieldType);
            }
            return(materialDict[meaning]);
        }
Exemple #2
0
        /// <summary>
        /// Retrieve color associated with ColorMeaning <paramref name="meaning"/>.
        /// </summary>
        /// <param name="meaning"></param>
        /// <returns></returns>
        public Color GetColor(ColorMeaning meaning, InteractionField fieldType)
        {
            switch (meaning)
            {
            case ColorMeaning.Positive: return(GetFieldColors(fieldType).positiveColor);

            case ColorMeaning.Negative: return(GetFieldColors(fieldType).negativeColor);

            case ColorMeaning.Neutral: return(neutral);

            case ColorMeaning.Error: return(error);

            default: return(error);
            }
        }