public static AbstractHalfBlockColor RandomPrimaryColor() { HalfBlockColor color; ArrayList primaryColors = new ArrayList(); primaryColors.Add(ColorModel.RED); primaryColors.Add(ColorModel.YELLOW); primaryColors.Add(ColorModel.BLUE); float random = UnityEngine.Random.value; Color c = new Color(); foreach (KeyValuePair <Color, float> entry in StructureReader.colorsMap) { if (random <= entry.Value) { c = entry.Key; break; } } if (!primaryColors.Contains(c)) { c = splitSecondary(c); color = new HalfBlockColor(c); color.isSecondaryColor = true; return(color); } color = new HalfBlockColor(c); color.isSecondaryColor = false; return(color); }
public void CombineColorTest(Color firstColor, Color secondColor, Color expectedColor) { AbstractHalfBlockColor first = new HalfBlockColor(firstColor); AbstractHalfBlockColor second = new HalfBlockColor(secondColor); AbstractHalfBlockColor expected = new HalfBlockColor(expectedColor); AbstractHalfBlockColor result = first.CombineColor(second); Assert.True(expected.Equals(result)); }
public void EqualsTest() { AbstractHalfBlockColor _otherGreen = new HalfBlockColor(ColorModel.GREEN); Assert.True(_green.Equals(_otherGreen)); }