Exemple #1
0
        public CellMap(AxialCoord Coords_, string[] Properties_)
        {
            ID     = Coords_.x * 1000 + Coords_.y;
            Coords = Coords_;

            SetProp(Properties_);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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());
            }
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 public Nation(AxialCoord BaseCoord)
 {
     Vision = new List <CellMap>();
 }
Exemple #6
0
 public int Distance(AxialCoord b) => Subtract(b).Length();
Exemple #7
0
 public AxialCoord Subtract(AxialCoord other) => new AxialCoord(x - other.x, y - other.y);
Exemple #8
0
 public AxialCoord Add(AxialCoord other) => new AxialCoord(x + other.x, y + other.y);
Exemple #9
0
 public static CellMap Find(List <CellMap> Array, AxialCoord Coord) => Find(Array, Coord.x * 1000 + Coord.y, 0, Array.Count);
Exemple #10
0
 private void DrawImage(AxialCoord Pt, string Key, Bitmap SecondImg = null) => DrawImage(Pt, GexesList.Images.IndexOfKey(Key), SecondImg);