public CellMap(AxialCoord Coords_, string[] Properties_) { ID = Coords_.x * 1000 + Coords_.y; Coords = Coords_; SetProp(Properties_); }
public AxialCoord[] СubeSpiral(AxialCoord center, int Radius) { List <AxialCoord> Coords = new List <AxialCoord> { center }; for (int i = 1; i < Radius; i++) { Coords.AddRange(СubeRing(center, i)); } AxialCoord[] Result = new AxialCoord[Coords.Count]; for (int i = 0; i < Result.Length; i++) { Result[i] = Coords[i]; } return(Result); }
private void DrawImage(AxialCoord Pt, int Index, Bitmap SecondImg = null) { try { PointF coord = _GridType.Draw(Pt.Subtract(_Location), _StartPos); Bitmap Img = (Bitmap)GexesList.Images[Index]; if (SecondImg != null) { Img = ImageAdditions(Img, SecondImg, 200); } _Gr.DrawImage(Img, (int)Math.Round(coord.X - 32), (int)Math.Round(coord.Y - 28)); } catch { MessageBox.Show(CellMap.Find(_LocationList, Pt).ToString()); } }
public AxialCoord[] СubeRing(AxialCoord center, int Radius) { AxialCoord[] Coords = new AxialCoord[Radius * 6]; CubeCoord cube = new CubeCoord().Neighbor(4).Scale(Radius).Add(center.ToCube()); int Index = 0; for (int i = 0; i < 6; i++) { for (int j = 0; j < Radius; j++) { Coords[Index] = new AxialCoord(cube.q, cube.r); cube = cube.Neighbor(i); Index++; } } return(Coords); }
public Nation(AxialCoord BaseCoord) { Vision = new List <CellMap>(); }
public int Distance(AxialCoord b) => Subtract(b).Length();
public AxialCoord Subtract(AxialCoord other) => new AxialCoord(x - other.x, y - other.y);
public AxialCoord Add(AxialCoord other) => new AxialCoord(x + other.x, y + other.y);
public static CellMap Find(List <CellMap> Array, AxialCoord Coord) => Find(Array, Coord.x * 1000 + Coord.y, 0, Array.Count);
private void DrawImage(AxialCoord Pt, string Key, Bitmap SecondImg = null) => DrawImage(Pt, GexesList.Images.IndexOfKey(Key), SecondImg);