Inheritance: BaseGrid
Exemplo n.º 1
0
 public StaticGrid(StaticGrid b)
     : base(b)
 {
     var tMatrix = new bool[b.width][];
     for (var widthTrav = 0; widthTrav < b.width; widthTrav++)
     {
         tMatrix[widthTrav] = new bool[b.height];
         for (var heightTrav = 0; heightTrav < b.height; heightTrav++)
         {
             if(b.IsWalkableAt(widthTrav,heightTrav))
                 tMatrix[widthTrav][heightTrav] = true;
             else
                 tMatrix[widthTrav][heightTrav] = false;
         }
     }
     this.m_nodes = buildNodes(b.width, b.height, tMatrix);
 }
Exemplo n.º 2
0
 public StaticGrid(StaticGrid b)
     : base(b)
 {
     bool[][] tMatrix = new bool[b.width][];
     for (int widthTrav = 0; widthTrav < b.width; widthTrav++)
     {
         tMatrix[widthTrav] = new bool[b.height];
         for (int heightTrav = 0; heightTrav < b.height; heightTrav++)
         {
             if (b.IsWalkableAt(widthTrav, heightTrav))
             {
                 tMatrix[widthTrav][heightTrav] = true;
             }
             else
             {
                 tMatrix[widthTrav][heightTrav] = false;
             }
         }
     }
     this.m_nodes = buildNodes(b.width, b.height, tMatrix);
 }
Exemplo n.º 3
0
        public override BaseGrid Clone()
        {
            int tWidth  = width;
            int tHeight = height;

            Node[][] tNodes = this.m_nodes;

            StaticGrid tNewGrid = new StaticGrid(tWidth, tHeight, null);

            Node[][] tNewNodes = new Node[tWidth][];
            for (int widthTrav = 0; widthTrav < tWidth; widthTrav++)
            {
                tNewNodes[widthTrav] = new Node[tHeight];
                for (int heightTrav = 0; heightTrav < tHeight; heightTrav++)
                {
                    tNewNodes[widthTrav][heightTrav] = new Node(widthTrav, heightTrav, tNodes[widthTrav][heightTrav].walkable);
                }
            }
            tNewGrid.m_nodes = tNewNodes;

            return(tNewGrid);
        }
Exemplo n.º 4
0
        public override BaseGrid Clone()
        {
            var tWidth = width;
            var tHeight = height;
            var tNodes = this.m_nodes;

            var tNewGrid = new StaticGrid(tWidth, tHeight, null);

            var tNewNodes = new Node[tWidth][];
            for (var widthTrav = 0; widthTrav < tWidth; widthTrav++)
            {
                tNewNodes[widthTrav] = new Node[tHeight];
                for (var heightTrav = 0; heightTrav < tHeight; heightTrav++)
                {
                    tNewNodes[widthTrav][heightTrav] = new Node(widthTrav, heightTrav, tNodes[widthTrav][heightTrav].walkable);
                }
            }
            tNewGrid.m_nodes = tNewNodes;

            return tNewGrid;
        }
Exemplo n.º 5
0
    private void CacheJumpPointParam()
    {
        if (staticlyCachedJpParam == null)
        {
            BaseGrid searchGrid = new StaticGrid(world.Width, world.Height);

            foreach (Tile roadTile in world.RoadTiles)
                searchGrid.SetWalkableAt(roadTile.x, roadTile.z, true);

            staticlyCachedJpParam = new JumpPointParam(searchGrid);
        }
    }