public void DrawLine(Transform mazeField, MazePoint p, Direction d, int z, LineColour colour) { var currentLevel = p.Z == z; switch (d) { case Direction.Left: if (currentLevel) { DrawLeftLine(p, mazeField, colour); } break; case Direction.Right: if (currentLevel) { DrawRightLine(p, mazeField, colour); } break; case Direction.Down: if (currentLevel) { DrawDownLine(p, mazeField, colour); } if (p.Z - 1 == z) { DrawUpLine(p, mazeField, colour); } break; case Direction.Up: if (currentLevel) { DrawUpLine(p, mazeField, colour); } if (p.Z + 1 == z) { DrawDownLine(p, mazeField, colour); } break; case Direction.Back: if (currentLevel) { DrawBackLine(p, mazeField, colour); } break; case Direction.Forward: if (currentLevel) { DrawForwardLine(p, mazeField, colour); } break; default: throw new ArgumentOutOfRangeException(); } }
public SpriteRenderer GetLine(LineOption option, LineColour colour) { Sprite sprite = null; switch (option) { case LineOption.HalfLine: sprite = _spriteCache.GetSprite(String.Format("halfLine{0}", Enum.GetName(typeof(LineColour), colour))); break; case LineOption.FullLine: sprite = _spriteCache.GetSprite(String.Format("fullLine{0}", Enum.GetName(typeof(LineColour), colour))); break; default: throw new ArgumentOutOfRangeException(); } var spriteRendererObj = new GameObject(); spriteRendererObj.AddComponent <SpriteRenderer>(); var spriteRenderer = spriteRendererObj.GetComponent <SpriteRenderer>(); spriteRenderer.sprite = sprite; return(spriteRenderer); }
private void DrawRightLine(MazePoint p, Transform mazeField, LineColour colour) { var sprite = _lineLoader.GetLine(LineOption.FullLine, colour); sprite.transform.SetParent(mazeField, false); sprite.transform.localPosition = new Vector3(_cellInformation.CellSize * p.X + _cellInformation.CellSize / 2, _cellInformation.CellSize * p.Y, -5); sprite.transform.localScale = new Vector3(_cellInformation.LineWidth, _cellInformation.LineHeight, 0); }
private void DrawDownLine(MazePoint p, Transform mazeField, LineColour colour) { var sprite = _lineLoader.GetLine(LineOption.HalfLine, colour); sprite.transform.SetParent(mazeField, false); sprite.transform.localPosition = new Vector3(_cellInformation.CellSize * p.X - _cellInformation.QuarterCellSize / 2, _cellInformation.CellSize * p.Y - _cellInformation.QuarterCellSize / 2, -5); sprite.transform.localScale = new Vector3(_cellInformation.QuarterLineWidth * 3, _cellInformation.LineHeight, 0); sprite.transform.Rotate(0, 0, 45); }
public override int GetHashCode() { unchecked { var n = 23; var hash = 17; hash = hash * n + IconUrl.GetHashCode(); hash = hash * n + IconColour.GetHashCode(); hash = hash * n + IconScale.GetHashCode(); hash = hash * n + LineColour.GetHashCode(); hash = hash * n + LineWidth.GetHashCode(); hash = hash * n + PolygonColour.GetHashCode(); return(hash); } }
private void Blue_Selected(object sender, RoutedEventArgs e) => CurrentColour = LineColour.Blue;
private void Red_Selected(object sender, RoutedEventArgs e) => CurrentColour = LineColour.Red;