public void SetLight(bool isLit, ColorName spaceColor) { if (MyColor.ToColor(spaceColor) == myColor.GetColor()) { correctSprite.enabled = true; incorrectSprite.enabled = false; return; } //If space isn't lit up or if the color is a composite of the target, don't do anything if (!isLit || (MyColor.IsComposite(myColor.GetColorName(), spaceColor))) { correctSprite.enabled = false; incorrectSprite.enabled = false; return; } incorrectSprite.enabled = true; correctSprite.enabled = false; }
/// <summary> /// Returns a color if horizontal and vertical share the same color /// Otherwise returns Color.white /// </summary> public ColorName GetSpaceColor() { List <MyColor> colors = GetColors(); if (colors.Count == 0) { return(ColorName.NONE); } while (colors.Count > 1) { MyColor a = colors[0]; MyColor b = colors[1]; colors.Remove(a); colors.Remove(b); MyColor newColor = MyColor.Mix(a.GetColorName(), b.GetColorName()); colors.Add(newColor); } return(colors[0].GetColorName()); }
public override bool Equals(object obj) { MyColor objColor = (MyColor)obj; return(GetColorName() == objColor.GetColorName()); }
public ColorName GetColorName() { return(myColor.GetColorName()); }