Esempio n. 1
0
 public void SetColored(IColored newColored, string colorName)
 {
     this.colored          = newColored;
     pickerToggleText.text = colorName;
     displayColor(newColored.color);
     newColored.addOnColorChangeListner(displayColor);
 }
Esempio n. 2
0
        public bool CanCollideWith(IColored other)
        {
            if (Value.Equals(other.Color))
                return true;

            if (_parent is PhysicalObject2D)
            {
                PhysicalObject2D parentObject = (PhysicalObject2D)_parent;

                if (parentObject.MovableBehaviour != null && other.Color == Color.White)
                    return true;

            }

            if (other is PhysicalObject2D)
            {
                PhysicalObject2D otherObject = (PhysicalObject2D)other;
                if (otherObject.MovableBehaviour != null && Value == Color.White)
                    return true;
            }

            if (other is IDeadly)
                if (Value == Color.White)
                    return true;

            return false;
        }
Esempio n. 3
0
 public void SetColored(IColored colored, string name)
 {
     this.colored          = colored;
     pickerToggleText.text = name;
     displayColor(colored.color);
     colored.addOnColorChangeListner(displayColor);
 }
Esempio n. 4
0
        public void AddColored(IColored colored, string colorName)
        {
            if (colored == null)
            {
                return;
            }
            var itemObj = Instantiate(colorItemPrefab, listContainer.transform, true);
            var item    = itemObj.GetComponent <ColorItem>();

            item.picker = picker;
            item.SetColored(colored, colorName);
            item.pickerToggle.group = colorItemsGroup;
            colorItemsGroup.RegisterToggle(item.pickerToggle);
            items.Add(item);
        }
Esempio n. 5
0
        public void SetColor(GridPiece gridPiece, bool random)
        {
            IColored cPiece = gridPiece.GetComponent <IColored>();

            if (cPiece == null)
            {
                return;
            }

            int columnIndex = (GridMap.Count - 1).GetColumn(mGridYLength);
            int rowIndex    = (GridMap.Count - 1).GetRow(mGridYLength);

            if (random || (columnIndex == 0) || ((columnIndex % 2 != 0) && (rowIndex == 0)))
            {
                int cI = UnityEngine.Random.Range(0, mColors.Length);
                cPiece.ChangeColor(cI, mColors[cI]);
                return;
            }

            List <IndexGroup> groupHolder = SelectableTriangles(gridPiece);
            int randomColorIndex          = UnityEngine.Random.Range(0, mColors.Length);

            cPiece.ColorIndex = randomColorIndex;
            if (groupHolder.CheckColorCount(this, 1) == true)
            {
                for (int i = 0; i < mColors.Length - 1; i++)
                {
                    randomColorIndex++;
                    if (randomColorIndex >= mColors.Length)
                    {
                        randomColorIndex -= mColors.Length;
                    }
                    cPiece.ColorIndex = randomColorIndex;
                    if (groupHolder.CheckColorCount(this, 1) == false)
                    {
                        break;
                    }
                }
            }
            cPiece.ChangeColor(randomColorIndex, mColors[randomColorIndex]);
            return;
        }
        protected override void OnDrawItem(DrawItemEventArgs args)
        {
            if (args.Index < 0 || args.Index >= Items.Count)
            {
                base.OnDrawItem(args);
                return;
            }

            IColored colored   = Items[args.Index] as IColored;
            Color    foreColor = colored == null ? args.ForeColor : colored.ForeColor;
            var      newArgs   = new DrawItemEventArgs(
                args.Graphics, args.Font, args.Bounds,
                args.Index,
                args.State,
                foreColor,
                args.BackColor
                );

            base.OnDrawItem(newArgs);
        }
Esempio n. 7
0
    public void GiveAColorToTheCreatedHexagonalPiece(GridPiece gridPiece, bool random)
    {
        IColored cPiece = gridPiece.GetComponent <IColored> ();

        if (cPiece == null)
        {
            return;
        }
        int stunIndex  = (GridMap.Count - 1).GetColumnOfIndex(gridYLength);
        int satırIndex = (GridMap.Count - 1).GetRowOfIndex(gridYLength);

        if (random || (stunIndex == 0) || ((stunIndex % 2 != 0) && (satırIndex == 0)))
        {
            int cI = Random.Range(0, colors.Length);
            cPiece.ChangeColor(cI, colors [cI]);
            return;
        }
        List <IndexGroup> groupHolder = SelectableTrianglesOfaGridPiece(gridPiece);
        int randomColorIndex          = Random.Range(0, colors.Length);

        cPiece.ColorIndexOfThisPiece = randomColorIndex;
        if (groupHolder.CheckForGroupElementsHaveAGivenCountOfDifferentColor(1) == true)
        {
            for (int i = 0; i < colors.Length - 1; i++)
            {
                randomColorIndex++;
                if (randomColorIndex >= colors.Length)
                {
                    randomColorIndex -= colors.Length;
                }
                cPiece.ColorIndexOfThisPiece = randomColorIndex;
                if (groupHolder.CheckForGroupElementsHaveAGivenCountOfDifferentColor(1) == false)
                {
                    break;
                }
            }
        }
        cPiece.ChangeColor(randomColorIndex, colors [randomColorIndex]);
        return;
    }
Esempio n. 8
0
        public string Shake(IColored a, IColored b, Processor intel)
        {
            var typeOfFirstColor = a.GetType();
            var typeOfSecondColor = b.GetType();
            var names = typeOfFirstColor.Name.ToLower() + typeOfSecondColor.Name.ToLower();
            switch (names)
            {
                case "redred":
                    return intel.Mix(new Red(a), new Red(b));

                case "greengreen":
                    return intel.Mix(new Green(a), new Green(b));

                case "redgreen":
                    return intel.Mix(new Red(a), new Green(b));

                case "greenred":
                    return intel.Mix(new Green(a), new Red(b));
                default:
                    return default(string);
            }
        }
Esempio n. 9
0
        public string Shake(IColored a, IColored b, Processor intel)
        {
            var typeOfFirstColor  = a.GetType();
            var typeOfSecondColor = b.GetType();
            var names             = typeOfFirstColor.Name.ToLower() + typeOfSecondColor.Name.ToLower();

            switch (names)
            {
            case "redred":
                return(intel.Mix(new Red(a), new Red(b)));

            case "greengreen":
                return(intel.Mix(new Green(a), new Green(b)));

            case "redgreen":
                return(intel.Mix(new Red(a), new Green(b)));

            case "greenred":
                return(intel.Mix(new Green(a), new Red(b)));

            default:
                return(default(string));
            }
        }
Esempio n. 10
0
 public ColorBehaviour(IColored parent)
 {
     _parent = parent;
 }
Esempio n. 11
0
 private string Submix(IColored a, IColored b)
 {
     return a.Paint() + "_" + b.Paint();
 }
Esempio n. 12
0
 public Red(IColored red)
 {
 }
Esempio n. 13
0
 public Green(IColored green)
 {
 }
Esempio n. 14
0
 public ColorPair(IColored first, IColored second, string answer)
 {
     FirstColor  = first;
     SecondColor = second;
     Answer      = answer;
 }
Esempio n. 15
0
 public void ProcessColored_ColoredValues_ShouldPass(bool isProcessed, IColored[] colored)
 {
     ColorHelper colorHelper = ColorHelpersFactory.GetColorHelper();
     bool actual = colorHelper.ProcessColored(colored);
     Assert.Equal(isProcessed, actual);
 }
Esempio n. 16
0
 public ColorPair(IColored first, IColored second, string answer)
 {
     FirstColor = first;
     SecondColor = second;
     Answer = answer;
 }
Esempio n. 17
0
 public void RegisterColored(IColored colored)
 {
     _coloreds.Add(colored);
 }
Esempio n. 18
0
 internal Blue(IColored blue)
 {
     Hash = blue.Hash;
     Color = blue.Color;
 }
Esempio n. 19
0
 internal Red(IColored red)
 {
     Hash = red.Hash;
     Color = red.Color;
 }
Esempio n. 20
0
 internal Red(IColored red)
 {
     Hash  = red.Hash;
     Color = red.Color;
 }
Esempio n. 21
0
 public Green(IColored green)
 {
 }
Esempio n. 22
0
 internal Blue(IColored blue)
 {
     Hash  = blue.Hash;
     Color = blue.Color;
 }
Esempio n. 23
0
 private string Submix(IColored a, IColored b)
 {
     return(a.Paint() + "_" + b.Paint());
 }
Esempio n. 24
0
 public Red(IColored red)
 {
 }