Esempio n. 1
0
    public Astar(int x, int y, int tox, int toy, int[,] M, int MX, int MY)//int x,int y,int tox,int toy
    {
        open      = new List <int> ();
        close     = new List <int> ();
        final     = new List <AstarNode> ();
        finalpath = new List <int[]> ();
        ToX       = tox;
        ToY       = toy;
        FromX     = x;
        FromY     = y;
        AstarNode bg = new AstarNode(x, y);

        bg.parentID = -1;
        bg.G        = 0;
        bg.H        = (x - tox) * (x - tox) + (y - toy) * (y - toy);
        bg.F        = bg.G + bg.H;
        addToFinal(bg);
        addToOpen(CheckInFinal(x, y));
        map            = M;
        MaxX           = MX;
        MaxY           = MY;
        MAXLength      = 10;
        isWalkableFunc = isWalkabeFuncDefault;
        //Debug.Log (map[ToX,ToY]);
        //Run ();
    }
Esempio n. 2
0
 public Astar()     //int x,int y,int tox,int toy
 {
     open           = new List <int> ();
     close          = new List <int> ();
     final          = new List <AstarNode> ();
     finalpath      = new List <int[]> ();
     isWalkableFunc = isWalkabeFuncDefault;
 }
 : base(animation) => Initialize(position, layer, isWalkable, isTransparent);
 : base(1, 1, font) => Initialize(position, layer, isWalkable, isTransparent);
 : base(foreground, background, glyph) => Initialize(position, layer, isWalkable, isTransparent);