示例#1
0
        public void OpenSquare(int y, int x, int[] parent, int moveCost, double heuristic, bool newSquare)
        {
            if (!newSquare)
            {
                foreach (OpenSquare op in OpenList)
                {
                    if (op.Y == y && op.X == x)
                    {
                        newSquare = true;
                        break;
                    }
                }
            }

            if (!newSquare)
            {
                OpenList.Add(new OpenSquare(y, x));
                MapStatus.RemoveAll((c) => c.X == x && c.Y == y);
                MapStatus.Add(new CellInfo(heuristic, null, true, false, x, y));
            }

            CellInfo cell = GetCellInfo(y, x);

            cell.Parent       = parent;
            cell.MovementCost = moveCost;
        }