Exemple #1
0
 public void SetNeighbour(PixelPos x, PixelPos y, GreatPixel pixel)
 {
     if (x == -1 && y == 1)
     {
         lt = pixel;
     }
     if (x == -1 && y == 0)
     {
         lc = pixel;
     }
     if (x == -1 && y == -1)
     {
         lb = pixel;
     }
     if (x == 0 && y == 1)
     {
         ct = pixel;
     }
     if (x == 0 && y == -1)
     {
         cb = pixel;
     }
     if (x == 1 && y == 1)
     {
         rt = pixel;
     }
     if (x == 1 && y == 0)
     {
         rc = pixel;
     }
     if (x == 1 && y == -1)
     {
         rb = pixel;
     }
 }
Exemple #2
0
        public void MoveToPosition(GreatPixel newPosition)
        {
            if (newPosition == null)
            {
                return;
            }

            if (Position != null)
            {
                Position.Type    = GreatPixelType.Empty;
                Position.Komorka = null;
            }

            this.Position         = newPosition;
            this.Position.Type    = GreatPixelType.Komorka;
            this.Position.Komorka = this;
        }
Exemple #3
0
        public GreatPixelSpace(PixelPos width, PixelPos height, PixelPos depth)
        {
            Space       = new GreatPixel[width, height, depth];
            this.Width  = width;
            this.Height = height;
            this.Depth  = depth;
            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    for (int z = 0; z < depth; z++)
                    {
                        Space[i, j, z] = new GreatPixel(new Vec3(i, j, z));
                    }
                }
            }

            for (int z = 0; z < depth; z++)
            {
                for (int i = 0; i < width; i++)
                {
                    for (int j = 0; j < height; j++)
                    {
                        GreatPixel pixel = Space[i, j, z];

                        // connect neighbours with each other
                        for (int di = -1; di <= 1; ++di)
                        {
                            for (int dj = -1; dj <= 1; ++dj)
                            {
                                if (i + di >= width || i + di < 0)
                                {
                                    continue;
                                }

                                if (j + dj >= height || j + dj < 0)
                                {
                                    continue;
                                }

                                if (di == 0 && dj == 0)
                                {
                                    continue;
                                }

                                GreatPixel neighbour = Space[i + di, j + dj, z];
                                pixel.SetNeighbour(di, dj, neighbour);
                            }
                        }

                        if (z + 1 < depth)
                        {
                            pixel.SetFront(Space[i, j, z + 1]);
                        }

                        if (z - 1 >= 0)
                        {
                            pixel.SetBack(Space[i, j, z - 1]);
                        }
                    }
                }
            }
        }
Exemple #4
0
 public override bool CanBeHere(GreatPixel position)
 {
     return(position.Komorka == null && position.Type == GreatPixelType.Empty);
 }
Exemple #5
0
 public abstract bool CanBeHere(GreatPixel position);
Exemple #6
0
 public void SetBack(GreatPixel pixel)
 {
     Back = pixel;
 }
Exemple #7
0
 public void SetFront(GreatPixel pixel)
 {
     Front = pixel;
 }