Ejemplo n.º 1
0
    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;
    }
Ejemplo n.º 2
0
    /// <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());
    }
Ejemplo n.º 3
0
    public override bool Equals(object obj)
    {
        MyColor objColor = (MyColor)obj;

        return(GetColorName() == objColor.GetColorName());
    }
Ejemplo n.º 4
0
 public ColorName GetColorName()
 {
     return(myColor.GetColorName());
 }