Esempio n. 1
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);
 }
Esempio n. 2
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);
        }