Exemplo n.º 1
0
        public void ApplyActionTestMoveDownNoCollision()
        {
            Block          anchor      = new Block(4, 4);
            SquareShape    shape       = new SquareShape(anchor, defaultOri);
            List <Vector2> coordinates = new List <Vector2>();

            foreach (Block b in shape.blocks)
            {
                coordinates.Add(new Vector2(b.GetX(), b.GetY()));
            }

            BlockGrid grid = new BlockGrid(10, 10);

            MovementManager.ApplyAction(InputAction.MoveDown, grid, shape);
            List <Vector2> expectedCoord = new List <Vector2>();

            foreach (Block b in shape.blocks)
            {
                expectedCoord.Add(new Vector2(b.GetX(), b.GetY()));
            }

            int i = 0;

            while (i < coordinates.Count() && i < expectedCoord.Count())
            {
                Assert.AreEqual(expectedCoord.ElementAt(i).X, coordinates.ElementAt(i).X);
                Assert.AreEqual(expectedCoord.ElementAt(i).Y, coordinates.ElementAt(i).Y - 1);
                i++;
            }
            Assert.IsFalse(shape.isPlaced);
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------
        // GamePlay testing Grid environment set-up methods
        //---------------------------------------------------------------------

        public void InitTestingBlockGrid_NonConsecutiveLinesScenario(BlockGrid grid)
        {
            if (grid.GetGridRowCount() == 30 && grid.GetGridColumnCount() == 10)
            {
                GameShape shape1 = new SquareShape(new Block(0, 1));
                grid.PlaceShape(shape1);

                GameShape shape2 = new SquareShape(new Block(2, 1));
                grid.PlaceShape(shape2);

                GameShape shape3 = new SquareShape(new Block(4, 1));
                grid.PlaceShape(shape3);

                GameShape shape4 = new SquareShape(new Block(6, 1));
                grid.PlaceShape(shape4);

                //NOTE:: Line only removed on is.Placed update (when a block is placed -- checks if lines need to be removed)
                GameShape shape5 = new LineShape(new Block(8, 2), ShapeRenderer.Orientation.ORIENT_1);
                grid.PlaceShape(shape5);

                // Non consecutive line

                GameShape shape6 = new SquareShape(new Block(6, 3));
                grid.PlaceShape(shape6);

                GameShape shape7 = new L2Shape(new Block(2, 3));
                grid.PlaceShape(shape7);

                GameShape shape8 = new L2Shape(new Block(5, 3));
                grid.PlaceShape(shape8);
            }
        }
Exemplo n.º 3
0
        private static void SampleOfOCP()
        {
            //Create shapes
            IShape        rectangle = new RectangleShape();
            IShape        square    = new SquareShape();
            DrawingShapes d         = new DrawingShapes();

            //add feature to draw rectangle
            d.AddShape(rectangle);
            //drawing images
            d.DrawImages();

            Console.WriteLine("Press Any key to Contunue the sample of OCP");
            Console.ReadKey();

            //add feature to draw square
            d.AddShape(square);

            //drawing images
            d.DrawImages();

            //try to implement another shape to see the important of this principle

            Console.ReadKey();
        }
Exemplo n.º 4
0
        // Author: DeAngelo Wilson
        public BlockGrid CompleteLinesInitialize()
        {
            BlockGrid grid = new BlockGrid(6, 6);

            GameShape shape1 = new SquareShape(new Block(0, 3), defaultOri);

            grid.PlaceShape(shape1);

            GameShape shape2 = new SquareShape(new Block(2, 1), defaultOri);

            grid.PlaceShape(shape2);

            GameShape shape3 = new SquareShape(new Block(0, 1), defaultOri);

            grid.PlaceShape(shape3);

            //complete line init
            GameShape shape4 = new SquareShape(new Block(4, 1), defaultOri);

            grid.PlaceShape(shape4);

            //2nd line needs 1 more square
            GameShape shape5 = new SquareShape(new Block(2, 3), defaultOri);

            grid.PlaceShape(shape5);

            return(grid);
        }
Exemplo n.º 5
0
        // Author: DeAngelo Wilson
        public BlockGrid VacantCoordsBlockGridInitialize(out List <Vector2> expectedPoints)
        {
            //points: (0,3) (0,4) (1,3) (1,4) -- (0,1) (0,2) (1,1) (1,2) -- (2,3) (2,4) (3,3) (3,4)
            expectedPoints = new List <Vector2>()
            {
                new Vector2(0, 0), new Vector2(1, 0), new Vector2(2, 0), new Vector2(3, 0), new Vector2(4, 0),
                new Vector2(2, 1), new Vector2(3, 1), new Vector2(4, 1),
                new Vector2(2, 2), new Vector2(3, 2), new Vector2(4, 2),
                new Vector2(4, 3), new Vector2(4, 4)
            };

            BlockGrid grid = new BlockGrid(5, 5);

            GameShape shape1 = new SquareShape(new Block(0, 3), defaultOri);

            grid.PlaceShape(shape1);

            GameShape shape2 = new SquareShape(new Block(2, 3), defaultOri);

            grid.PlaceShape(shape2);

            GameShape shape3 = new SquareShape(new Block(0, 1), defaultOri);

            grid.PlaceShape(shape3);

            return(grid);
        }
Exemplo n.º 6
0
        public Actor()
        {
            Pos       = new PointF();
            Shape     = new SquareShape(0.6f);
            Sprite    = new SquareSprite(MainGame.CellSize);
            Direction = new PointF(0, 0);

            Speed = 0.12f;
        }
Exemplo n.º 7
0
        public void CheckForCollisionsTest_Floating_Piece()
        {
            // Piece is not touching anything
            Block        anchor = new Block(3, 3);
            BlockGrid    grid   = new BlockGrid(6, 6);
            SquareShape  shape  = new SquareShape(anchor, defaultOri);
            List <Block> blocks = shape.blocks;

            Assert.AreEqual(false, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
Exemplo n.º 8
0
        public void ApplyActionTestMoveDownCollision()
        {
            Block       anchor = new Block(1, 2);
            SquareShape shape  = new SquareShape(anchor, defaultOri);
            BlockGrid   grid   = new BlockGrid(10, 10);

            shape.AboutToPlaceGameShape();
            MovementManager.ApplyAction(InputAction.MoveDown, grid, shape);
            Assert.IsTrue(shape.isPlaced);
        }
Exemplo n.º 9
0
        public void CheckForCollisionsTest_Bottom()
        {
            // block has reached the bottom
            Block        anchor = new Block(3, -1);
            BlockGrid    grid   = new BlockGrid(5, 5);
            SquareShape  shape  = new SquareShape(anchor, defaultOri);
            List <Block> blocks = shape.blocks;

            Assert.AreEqual(true, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
Exemplo n.º 10
0
        public void CheckForCollisionsTest_Left_Bound()
        {
            // block that we are about to add crosses the left bound
            Block        anchor = new Block(-1, 4);
            BlockGrid    grid   = new BlockGrid(5, 5);
            SquareShape  shape  = new SquareShape(anchor, defaultOri);
            List <Block> blocks = shape.blocks;

            Assert.AreEqual(true, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
Exemplo n.º 11
0
        public void CheckForCollisionsTest_Right_Bound()
        {
            // block that we are about to add exceeds max width
            Block        anchor = new Block(6, 3);
            BlockGrid    grid   = new BlockGrid(5, 5);
            SquareShape  shape  = new SquareShape(anchor, defaultOri);
            List <Block> blocks = shape.blocks;

            Assert.AreEqual(true, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
Exemplo n.º 12
0
        public void TestSquare()
        {
            RectangleShape square = new SquareShape();

            square.Height = 4;
            square.Width  = 6;



            Assert.AreEqual(16, square.Width * square.Height);
        }
Exemplo n.º 13
0
        public Area(PointF pos, Areas type, Image sprite = null, float scaleArea = 1, float scaleSprite = 1.05f)
        {
            this.Pos  = pos;
            this.Type = type;
            Shape     = new SquareShape(scaleArea);
            isDispose = false;

            if (sprite != null)
            {
                Sprite = new ImageSprite(sprite, PointOp.Mul(MainGame.CellSize, scaleSprite));
            }
        }
Exemplo n.º 14
0
        public void GetCompletedLinesTestWithGameShape()
        {
            BlockGrid grid = CompleteLinesInitialize();
            GameShape gs   = new SquareShape(new Block(4, 3), defaultOri);

            grid.PlaceShape(gs);

            List <int> lineIndexes = grid.GetCompletedLines(gs);


            Assert.AreEqual(2, lineIndexes.Count);
        }
Exemplo n.º 15
0
        public void CheckForCollisionsTest_Pieces_Touching()
        {
            Block     anchor        = new Block(3, 3);
            BlockGrid grid          = new BlockGrid(5, 5);
            GameShape existingShape = new SquareShape(anchor, defaultOri);

            // put an exisiting shape at the coordinate where we are placing a block
            grid.PlaceShape(existingShape);
            List <Block> blocks = existingShape.blocks;
            SquareShape  shape  = new SquareShape(anchor, defaultOri);

            Assert.AreEqual(true, MovementManager.CheckForCollisions(grid, blocks, shape));
        }
Exemplo n.º 16
0
        private void DrawTiltedSquare(int tilt)
        {
            SquareShape sqA     = new SquareShape(new XY(Dimension / 2, Dimension / 2), Dimension / 4, tilt);
            Polygon     sqProto = new Polygon();

            sqProto.Stroke          = new SolidColorBrush(Colors.Black);
            sqProto.StrokeThickness = 2;
            sqProto.Fill            = new SolidColorBrush(Color.FromArgb(255, (byte)((255 * tilt) / 360), 0, 0));

            SquareDrawer sqdA = new SquareDrawer(sqA, sqProto);

            sqdA.AttachToCanvas(MainCanvas.Instance.TheCanvas);
        }
Exemplo n.º 17
0
        private SquareShape BasicShapeInitialize(out List <Vector2> coordinates, ShapeRenderer.Orientation ori)
        {
            Block       anchor = new Block(100, 100);
            SquareShape square = new SquareShape(anchor, ori);

            coordinates = new List <Vector2>();
            foreach (Block b in square.blocks)
            {
                coordinates.Add(new Vector2(b.GetX(), b.GetY()));
            }

            return(square);
        }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            Console.WriteLine("Decorator Pattern !");

            var circle    = new CircleShape();
            var redCircle = new RedColor(circle);

            var square     = new SquareShape();
            var blueSquare = new BlueColor(square);

            redCircle.Draw();
            blueSquare.Draw();

            Console.ReadLine();
        }
Exemplo n.º 19
0
    void OnTriggerEnter2D(Collider2D other)
    {
        SquareShape elem = other.gameObject.GetComponent <SquareShape>();

        if (elem != null)
        {
            count++;
            Debug.Log("is square");
            if (count == maxcount)
            {
                Transform wall = Instantiate(prefab, this.transform.position, this.transform.rotation) as Transform;
            }
        }
        else
        {
            Debug.Log("Something other than a square has entered");
        }
    }
Exemplo n.º 20
0
        public void ApplyActionTestMoveRightNoCollision()
        {
            Block       anchor1 = new Block(1, 1);
            Block       anchor2 = new Block(1, 3);
            SquareShape shape1  = new SquareShape(anchor1, defaultOri);
            SquareShape shape2  = new SquareShape(anchor2, defaultOri);

            BlockGrid grid = new BlockGrid(10, 10);

            grid.PlaceShape(shape1);
            shape2.AboutToPlaceGameShape();

            Assert.IsTrue(shape2.isAboutToPlace);

            MovementManager.ApplyAction(InputAction.MoveRight, grid, shape2);
            MovementManager.ApplyAction(InputAction.MoveRight, grid, shape2);

            Assert.IsFalse(shape2.isAboutToPlace);
        }
Exemplo n.º 21
0
        public void InitTestingBlockGrid_DoubleLineScenario(BlockGrid grid)
        {
            if (grid.GetGridRowCount() == 30 && grid.GetGridColumnCount() == 10)
            {
                GameShape shape1 = new SquareShape(new Block(0, 1));
                grid.PlaceShape(shape1);

                GameShape shape2 = new SquareShape(new Block(2, 1));
                grid.PlaceShape(shape2);

                GameShape shape3 = new SquareShape(new Block(4, 1));
                grid.PlaceShape(shape3);

                GameShape shape4 = new SquareShape(new Block(6, 1));
                grid.PlaceShape(shape4);

                //NOTE:: Line only removed on is.Placed update (when a block is placed -- checks if lines need to be removed)
                //GameShape shape5 = new SquareShape(new Block(8, 1));
                //grid.PlaceShape(shape5);
            }
        }
Exemplo n.º 22
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //New version
            IDataSource ds  = new ColorFromTextDataSource("colors");
            IDataSource ds2 = new TimeSerieDataSource("stocks.txt", 16);

            int[] mapsize = new int [2];
            int   size    = 10;

            mapsize[0] = size;
            mapsize[1] = size;
            IMapShape    ms    = new SquareShape(mapsize);
            IKohonenCore kcgpu = new MSRAcceleratorKohonenCore();
            IKohonenCore kccpu = new CPUKohonenCore();

            somcpu = new KohonenSOM(kccpu, ms, ds2);
            somgpu = new KohonenSOM(kcgpu, ms, ds2);
            somcpu.Init();
            somgpu.Init();
            //pictureBox1.Image = som.ToWeightBitmap();
            //
        }
Exemplo n.º 23
0
    public void Train()
    {
        ShapeGenerator generator;

        switch (dropdown.value)
        {
        case 0:
            generator = new DefaultShape();
            break;

        case 1:
            generator = new SquareShape();
            break;

        case 2:
            generator = new SquareOutline();
            break;

        case 3:
            generator = new CircleOutline();
            break;

        case 4:
            generator = new TreeShape();
            break;

        default:
            generator = new DickShape();
            break;
        }

        trainer.initialWaspsPoints = Int32.Parse(initialHealth.text);
        trainer.waspReward         = Int32.Parse(healthReward.text);
        trainer.waspPunishment     = Int32.Parse(healthPunishment.text);
        trainer.maxWasps           = Int32.Parse(waspMax.text);

        trainer.StartTrain(generator);
    }
Exemplo n.º 24
0
        private Shape SetNewFigure()
        {
            Random numOfShape = new Random();
            Shape  figure     = null;

            switch (numOfShape.Next(0, 7))
            {
            case 0: figure = new StraightShape(); break;

            case 1: figure = new SquareShape(); break;

            case 2: figure = new TShape(); break;

            case 3: figure = new S_Shape(); break;

            case 4: figure = new ZShape(); break;

            case 5: figure = new JShape(); break;

            case 6: figure = new LShape(); break;
            }
            return(figure);
        }
Exemplo n.º 25
0
        // Author: DeAngelo Wilson
        public BlockGrid RemoveLinesInitialize(out List <Vector2> expectedPoints)
        {
            //points: (0,3) (0,4) (1,3) (1,4) -- (0,1) (0,2) (1,1) (1,2) -- (2,3) (2,4) (3,3) (3,4)
            expectedPoints = new List <Vector2>()
            {
                new Vector2(0, 1), new Vector2(0, 2), new Vector2(1, 1), new Vector2(1, 2), new Vector2(2, 2), new Vector2(2, 1),
                new Vector2(3, 2), new Vector2(3, 1)
            };



            BlockGrid grid = new BlockGrid(6, 6);

            GameShape shape1 = new SquareShape(new Block(0, 3), defaultOri);

            grid.PlaceShape(shape1);

            GameShape shape2 = new SquareShape(new Block(2, 1), defaultOri);

            grid.PlaceShape(shape2);

            GameShape shape3 = new SquareShape(new Block(0, 1), defaultOri);

            grid.PlaceShape(shape3);

            //complete line init
            GameShape shape4 = new SquareShape(new Block(4, 1), defaultOri);

            grid.PlaceShape(shape4);

            //2nd line needs 1 more square
            GameShape shape5 = new SquareShape(new Block(2, 3), defaultOri);

            grid.PlaceShape(shape5);

            return(grid);
        }
Exemplo n.º 26
0
        public EVR(PointF pos, Game.Actors.Static.Area ar, float scaleArea = 1f, float scaleSprite = 1f)
        {
            Directs.Add(new PointF(1, 0));
            Directs.Add(new PointF(0, 1));
            Directs.Add(PointOp.Normalize(new PointF(1, 1)));
            Directs.Add(new PointF(-1, 0));
            Directs.Add(new PointF(0, -1));
            Directs.Add(PointOp.Normalize(new PointF(-1, -1)));

            Directs.Add(PointOp.Normalize(new PointF(1, 1)));
            Directs.Add(PointOp.Normalize(new PointF(-1, 1)));
            Directs.Add(PointOp.Normalize(new PointF(1, -1)));
            Directs.Add(PointOp.Normalize(new PointF(-1, -1)));



            this.Pos  = pos;
            Shape     = new SquareShape(scaleArea);
            area      = ar;
            Sprite    = new SquareSprite(PointOp.Mul(MainGame.CellSize, scaleSprite), Brushes.Brown);
            Direction = Directs[0];

            Speed = 0.06f;
        }
Exemplo n.º 27
0
        static void Main(string[] args)
        {
            SquareShape   square   = new SquareShape();
            TriangleShape triangle = new TriangleShape();
            CircleShape   circle   = new CircleShape();

            float side = 5;

            square.sideLenght   = side;
            triangle.sideLenght = side;
            circle.radius       = side;

            square.Init();
            triangle.Init();
            circle.Init();

            square.Perimetr();
            triangle.Perimetr();
            circle.Perimetr();

            square.Square();
            triangle.Square();
            circle.Square();

            Console.WriteLine("SquareShape");
            Console.WriteLine("perimetr: {0}", square.perimetr);
            Console.WriteLine("square: {0}", square.square);

            Console.WriteLine("TriangleShape");
            Console.WriteLine("perimetr: {0}", triangle.perimetr);
            Console.WriteLine("square: {0}", triangle.square);

            Console.WriteLine("CircleShape");
            Console.WriteLine("perimetr: {0}", circle.perimetr);
            Console.WriteLine("square: {0}", circle.square);
        }
Exemplo n.º 28
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Application.Idle += new EventHandler(Application_Idle);

            IEngine engine = new Engine("AopDraw");

            InterfaceAspect canvasAwareAspect = new InterfaceAspect("canvasAwareAspect", typeof(Shape), new Type[] { typeof(CanvasAwareMixin) }, new IPointcut[] { new SignaturePointcut("set_*", new ShapePropertyInterceptor()) });

            engine.Configuration.Aspects.Add(canvasAwareAspect);

            InterfaceAspect typeDescriptorAspect = new InterfaceAspect("typeDescriptorAspect", typeof(Shape), new Type[] { typeof(CustomTypeDescriptorMixin) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(typeDescriptorAspect);

            InterfaceAspect guidAspect = new InterfaceAspect("guidAspect", typeof(Shape), new Type[] { typeof(GuidObject) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(guidAspect);

            AttributeAspect resizableAspect = new AttributeAspect("resizableAspect", typeof(ResizableAttribute), new Type[] { typeof(ResizableShape2DMixin) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(resizableAspect);

            AttributeAspect selectable2DAspect = new AttributeAspect("selectable2DAspect", typeof(SelectableAttribute), new Type[] { typeof(SelectableShape2DMixin) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(selectable2DAspect);

            InterfaceAspect selectable1DAspect = new InterfaceAspect("selectable1DAspect", typeof(Shape1D), new Type[] { typeof(SelectableShape1DMixin) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(selectable1DAspect);

            InterfaceAspect mouseEventAspect = new InterfaceAspect("mouseEventAspect", typeof(Shape), new Type[] { typeof(MouseHandlerMixin) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(mouseEventAspect);

            AttributeAspect movableAspect = new AttributeAspect("movableAspect", typeof(MovableAttribute), new Type[] { typeof(MovableShape2DMixin) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(movableAspect);

            InterfaceAspect movableShape1DAspect = new InterfaceAspect("movableShape1DAspect", typeof(Shape1D), new Type[] { typeof(MovableShape1DMixin) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(movableShape1DAspect);

            AttributeAspect designableAspect = new AttributeAspect("designableAspect", typeof(DesignableAttribute), new Type[] { typeof(DesignableMixin) }, new IPointcut[] { });

            engine.Configuration.Aspects.Add(designableAspect);



            SquareShape square = engine.CreateProxy <SquareShape>();

            square.X      = 10;
            square.Y      = 10;
            square.Width  = 100;
            square.Height = 100;

            canvas.AddShape(square);


            CircleShape circle = engine.CreateProxy <CircleShape>();

            circle.X      = 240;
            circle.Y      = 120;
            circle.Width  = 200;
            circle.Height = 200;

            canvas.AddShape(circle);


            rectangle        = engine.CreateProxy <RectangleShape>();
            rectangle.X      = 50;
            rectangle.Y      = 90;
            rectangle.Width  = 200;
            rectangle.Height = 50;

            canvas.AddShape(rectangle);

            Line line = engine.CreateProxy <Line>();

            line.X  = 200;
            line.Y  = 200;
            line.X2 = 400;
            line.Y2 = 340;
            canvas.AddShape(line);


            TextShape text = engine.CreateProxy <TextShape>();

            text.X      = 140;
            text.Y      = 3;
            text.Width  = 200;
            text.Height = 100;
            canvas.AddShape(text);
        }
Exemplo n.º 29
0
 public SquareDrawer(SquareShape shape, Polygon prototype, double canvasTop = 0, double canvasLeft = 0, int zIndex = 1)
     : base(shape, prototype, canvasTop, canvasLeft, zIndex)
 {
 }
Exemplo n.º 30
0
    void GetAccess()
    {
        //If open list count is empty
        if (generationList.Count > 0 && !EndPosition._isScannedArea)
        {
            //It sets the current block as first on the list
            GridGeneration currentTile = generationList[0];

            //The Block with the smallest movement cost is found
            for (int i = 1; i < generationList.Count; i++)
            {
                float newHeuristic = 0.0f;
                float curHeuristic = 0.0f;

                if (algorithmType == PathDecisionAlgorithm.AStarStyleAlgorithm)
                {
                    if (BlockStyle == BlockGrid.SquareShape)
                    {
                        SquareShape newSquareShape = ((SquareShapeScript)generationList[i]).transformValue;
                        SquareShape curSquareShape = ((SquareShapeScript)currentTile).transformValue;

                        newHeuristic = newSquareShape.GetHeuristic(EndPosition.a, EndPosition.b);
                        curHeuristic = curSquareShape.GetHeuristic(EndPosition.a, EndPosition.b);
                    }
                    else if (BlockStyle == BlockGrid.HexagonShape)
                    {
                        HexagonShape newHexagonShape = ((HexagonShapeScript)generationList[i]).transformValueHexagon;
                        HexagonShape curHexagonShape = ((HexagonShapeScript)currentTile).transformValueHexagon;

                        newHeuristic = newHexagonShape.GetHeuristic(EndPosition.a, EndPosition.b);
                        curHeuristic = curHexagonShape.GetHeuristic(EndPosition.a, EndPosition.b);
                    }
                    newHeuristic *= weight;
                    curHeuristic *= weight;
                }

                if (generationList[i].trackPos + newHeuristic < currentTile.trackPos + curHeuristic)
                {
                    currentTile = generationList[i];
                }
            }

            //It removes the current Block from open list
            currentTile._isScannedArea = true;
            generationList.Remove(currentTile);

            if (BlockStyle == BlockGrid.SquareShape)
            {
                //Neighbours of current block are taken
                SquareShape   s          = ((SquareShapeScript)currentTile).transformValue;
                SquareShape[] neighbours = s.getClosestBlock();

                for (int i = 0; i < neighbours.Length; i++)
                {
                    //Coordinate valid or not
                    if
                    (
                        neighbours[i].b < 0 || neighbours[i].b >= blockGrid.GetLength(0) ||
                        neighbours[i].a < 0 || neighbours[i].a >= blockGrid.GetLength(1)
                    )
                    {
                        continue;
                    }

                    //The coordinaes are transformed to grid piece script
                    GridGeneration closestBlock = GridManager.type.getBlocks(neighbours[i].a, neighbours[i].b);

                    //If neighbour does not exist, then skip
                    if (closestBlock == null)
                    {
                        continue;
                    }
                    //If neighbour is obstacle, then skip
                    if (closestBlock.isWall)
                    {
                        continue;
                    }
                    //If crossing diagonal gaps exist, then skip
                    if (blockSidewayWall && !ignoreSidewayWall && i % 2 != 0)
                    {
                        GridGeneration prevNeighbour = GridManager.type.getBlocks(s.getClosestBlock(i - 1).a, s.getClosestBlock(i - 1).b);
                        GridGeneration nextNeighbour = GridManager.type.getBlocks(s.getClosestBlock(i + 1).a, s.getClosestBlock(i + 1).b);
                        if (prevNeighbour.isWall && nextNeighbour.isWall) //If diagonal gap, then do not cross
                        {
                            continue;
                        }
                    }
                    //If neighbour is checked, then skip
                    if (closestBlock._isScannedArea)
                    {
                        continue;
                    }

                    //Setting the new cost to the neighbour's mevement cost
                    float newCost = currentTile.trackPos + s.GetCost(i);

                    //If the new cost is smaller than the neighbour movement cost, then replace it and set it as parent tile
                    if (newCost < closestBlock.trackPos)
                    {
                        closestBlock.trackPos   = newCost;
                        closestBlock.groupBlock = currentTile;

                        if (!generationList.Contains(closestBlock))
                        {
                            generationList.Add(closestBlock);
                        }
                    }
                }
            }
            else if (BlockStyle == BlockGrid.HexagonShape)
            {
                //Getting the neighbours of the current tile for the hexagon shape
                HexagonShape   Hexagon    = ((HexagonShapeScript)currentTile).transformValueHexagon;
                HexagonShape[] neighbours = Hexagon.GetNeighbours();

                for (int i = 0; i < neighbours.Length; i++)
                {
                    //Coordinates valid or not
                    if
                    (
                        neighbours[i].ToArrayPos(GridManager.type.blockNumber).b < 0 || neighbours[i].ToArrayPos(GridManager.type.blockNumber).b >= blockGrid.GetLength(0) ||
                        neighbours[i].ToArrayPos(GridManager.type.blockNumber).a < 0 || neighbours[i].ToArrayPos(GridManager.type.blockNumber).a >= blockGrid.GetLength(1)
                    )
                    {
                        continue;
                    }

                    //Coordinates a transfromed to grid piece script
                    GridGeneration neighbour = GridManager.type.getBlocks(neighbours[i].a, neighbours[i].b);

                    //If the neighbour does not exist, then skip
                    if (neighbour == null)
                    {
                        continue;
                    }
                    //If the neighbour is an obstacle, then skip
                    if (neighbour.isWall)
                    {
                        continue;
                    }
                    //also if is checked
                    if (neighbour._isScannedArea)
                    {
                        continue;
                    }

                    //Setting the new cost to neighbour's movement cost
                    float newCost = currentTile.trackPos + Hexagon.GetCost(i);

                    // If the new cost is smaller, then replace it and set it as the parent tile
                    if (newCost < neighbour.trackPos)
                    {
                        neighbour.trackPos   = newCost;
                        neighbour.groupBlock = currentTile;

                        if (!generationList.Contains(neighbour))
                        {
                            generationList.Add(neighbour);
                        }
                    }
                }
            }
        }
        else
        {
            //else, pathfinder is finding the next stage
            PathLocatingStyle = (pathLocatingProp)((int)PathLocatingStyle + 1);
        }
    }