public void SetColored(IColored newColored, string colorName) { this.colored = newColored; pickerToggleText.text = colorName; displayColor(newColored.color); newColored.addOnColorChangeListner(displayColor); }
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; }
public void SetColored(IColored colored, string name) { this.colored = colored; pickerToggleText.text = name; displayColor(colored.color); colored.addOnColorChangeListner(displayColor); }
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); }
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); }
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; }
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); } }
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)); } }
public ColorBehaviour(IColored parent) { _parent = parent; }
private string Submix(IColored a, IColored b) { return a.Paint() + "_" + b.Paint(); }
public Red(IColored red) { }
public Green(IColored green) { }
public ColorPair(IColored first, IColored second, string answer) { FirstColor = first; SecondColor = second; Answer = answer; }
public void ProcessColored_ColoredValues_ShouldPass(bool isProcessed, IColored[] colored) { ColorHelper colorHelper = ColorHelpersFactory.GetColorHelper(); bool actual = colorHelper.ProcessColored(colored); Assert.Equal(isProcessed, actual); }
public void RegisterColored(IColored colored) { _coloreds.Add(colored); }
internal Blue(IColored blue) { Hash = blue.Hash; Color = blue.Color; }
internal Red(IColored red) { Hash = red.Hash; Color = red.Color; }
private string Submix(IColored a, IColored b) { return(a.Paint() + "_" + b.Paint()); }