Example #1
0
        public CubePosition GetCubePosition()
        {
            //if (cube == null)
            {
                cube   = new CubePosition();
                cube.q = X;
                cube.s = Y - (X - (X & 1)) / 2;
                cube.r = -cube.q - cube.s;
            }

            //q = x;
            //r = y - (x - (x & 1)) / 2;
            //s = -q - r;

            return(cube);
        }
Example #2
0
        private void AddCube(int q, int r, int s)
        {
            CubePosition c1 = new CubePosition(q, r, s);

            if (c1.IsValid(Map))
            {
                /*if (Math.Abs(c1.q) <= Map.Model.MapHeight &&
                 *  Math.Abs(c1.r) <= Map.Model.MapHeight &&
                 *  Math.Abs(c1.s) <= Map.Model.MapHeight)
                 * {*/
                Tile t = Map.GetTile(c1.Pos);
                if (t != null)
                {
                    neighbors.Add(t);
                }
            }
        }