private void GetFace(string faceId) { CoreFace f = Core.GetFace(faceId); CartesianCoordinatesConverter c = new CartesianCoordinatesConverter(f.Coordinates); var blocks = Core.GetBlocksForFace(f.Id) .OfType <IPositionnedByCartesian3dVector>() .ToList(); blocks.Sort(new PlanePositionPointComparer(f.Coordinates)); foreach (Block b in blocks.OfType <Block>()) { Cartesian2dCoordinate c2 = c.ConvertTo2d(b.Position); System.Console.WriteLine($"{b.Id} {FormatCoordinates(b.Position)} {FormatCoordinates(c2)}"); } }
/// <summary> /// Gets the information allowing to display a Skewb cube face on the console. /// </summary> /// <param name="faceId">Id of the Skewb's face that will be displayed.</param> /// <returns>A SkewbFaceTextView object containing the color of the faces to display in the console for the requested face.</returns> public SkewbFaceTextView GetFaceAsText(string faceId) { CoreFace face = this.Cube.GetFace(faceId); var blocks = this.Cube.GetBlocksForFace(faceId); var sortedBlocks = blocks.OfType <IPositionnedByCartesian3dVector>().ToList(); sortedBlocks.Sort(new PlanePositionPointComparer(face.Coordinates)); var faces = sortedBlocks.OfType <Block>().Select(b => b.GetBlockFace(face.Coordinates.Normal)).ToList(); SkewbFaceTextView facesView = new SkewbFaceTextView { TopLeftColor = faces[0].Id, TopRightColor = faces[1].Id, CenterColor = faces[2].Id, BottomLeftColor = faces[3].Id, BottomRightColor = faces[4].Id }; return(facesView); }
private void Awake() { instance = this; }