Exemplo 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.length][];
         for (int lengthTrav = 0; lengthTrav < b.length; lengthTrav++)
         {
             tMatrix[widthTrav][lengthTrav] = new bool[b.height];
             for (int heightTrav = 0; heightTrav < b.height; heightTrav++)
             {
                 if (b.IsWalkableAt(widthTrav, lengthTrav, heightTrav))
                 {
                     tMatrix[widthTrav][lengthTrav][heightTrav] = true;
                 }
                 else
                 {
                     tMatrix[widthTrav][lengthTrav][heightTrav] = false;
                 }
             }
         }
     }
     this.m_nodes = buildNodes(b.width, b.length, b.height, tMatrix);
 }
Exemplo n.º 2
0
        public override BaseGrid Clone()
        {
            int tWidth  = width;
            int tHeight = height;
            int tLength = length;

            Node[][][] tNodes = this.m_nodes;

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

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

            return(tNewGrid);
        }