コード例 #1
0
ファイル: MNGR_Grid.cs プロジェクト: nablam/PowderHouseDev
    void Update_node_colors()
    {
        for (int x = 0; x < Matrix_Size.x; x++)
        {
            for (int z = 0; z < Matrix_Size.z; z++)
            {
                Transform T_Cell_in_grid;
                T_Cell_in_grid = GridArra[x, z];
                Brick cScript = T_Cell_in_grid.GetComponent <Brick>();
                //keepfor color
                //if(cScript.IsLegitPath)GridArra[x,z].renderer.material.color=Color.cyan;
                if (cScript.isStart)
                {
                    GridArra[x, z].GetComponent <Renderer>().material.color = Color.white;
                }
                if (cScript.isEnd)
                {
                    GridArra[x, z].GetComponent <Renderer>().material.color = Color.black;
                }
                if (!cScript.IsLegitPath)
                {
                    GridArra[x, z].GetComponent <Renderer>().material.color = Color.yellow;
                }

                //if(cScript.isStart)GridArra[x,z].renderer.material.color=Color.white;
                //if(cScript.isStart)GridArra[x,z].renderer.material.color=Color.white;
            }
        }
    }
コード例 #2
0
ファイル: MazeManager.cs プロジェクト: nablam/PowderHouseDev
 void populate_template()
 {
     for (int x = 0; x < Matrix_Size.x; x++)
     {
         for (int z = 0; z < Matrix_Size.z; z++)
         {
             Transform T_Cell_in_grid;
             T_Cell_in_grid = GridArra[x, z];
             NavMazeBlock cScript = T_Cell_in_grid.GetComponent <NavMazeBlock>();
             //cScript._F = cScript._H+ cScript._G ;
             T_Cell_in_grid.name = "(" + cScript.MyStupid__X + "," + cScript.MyStupid__Z + ")" + "g." + cScript._G + "h." + cScript._H + "f." + cScript._F;
         }
     }
 }
コード例 #3
0
ファイル: MazeManager.cs プロジェクト: nablam/PowderHouseDev
    void Update_node_colors()
    {
        for (int x = 0; x < Matrix_Size.x; x++)
        {
            for (int z = 0; z < Matrix_Size.z; z++)
            {
                Transform T_Cell_in_grid;
                T_Cell_in_grid = GridArra[x, z];
                NavMazeBlock cScript = T_Cell_in_grid.GetComponent <NavMazeBlock>();
                //keepfor color
                //if (cScript.IsLegitPath) GridArra[x, z].GetComponent<Renderer>().material.color = Color.cyan;
                //if (cScript.isStart) GridArra[x, z].GetComponent<Renderer>().material.color = Color.white;
                //if (cScript.isEnd) GridArra[x, z].GetComponent<Renderer>().material.color = Color.black;
                //if (!cScript.IsLegitPath) GridArra[x, z].GetComponent<Renderer>().material.color = Color.yellow;

                if (cScript.isfound)
                {
                    GridArra[x, z].GetComponent <NavMazeBlock>().UpdateTileMAterial(LightTiles[1]);
                }
                else
                {
                    GridArra[x, z].GetComponent <NavMazeBlock>().UpdateTileMAterial(DarkTiles[1]);
                }
                if (cScript.isStart)
                {
                    GridArra[x, z].GetComponent <NavMazeBlock>().UpdateTileMAterial(GreenMatDark);
                }
                if (cScript.isEnd)
                {
                    GridArra[x, z].GetComponent <NavMazeBlock>().UpdateTileMAterial(RedMAt);
                }
                // if (!cScript.isfound) { GridArra[x, z].GetComponent<NavMazeBlock>().UpdateBlockText("X"); }


                //if (Grid_end_ptr.GetComponent<NavMazeBlock>().isfound)
                //{
                //    Grid_end_ptr.GetComponent<NavMazeBlock>().UpdateTileMAterial(LightTiles[1]);

                //}
                //else
                //{
                //    Grid_end_ptr.GetComponent<NavMazeBlock>().UpdateTileMAterial(DarkTiles[1]);

                //}

                //if(cScript.isStart)GridArra[x,z].GetComponent<Renderer>().material.color=Color.white;
                //if(cScript.isStart)GridArra[x,z].GetComponent<Renderer>().material.color=Color.white;
            }
        }
    }
コード例 #4
0
ファイル: MazeManager.cs プロジェクト: nablam/PowderHouseDev
 void resetALL_G_H_F()
 {
     for (int x = 0; x < Matrix_Size.x; x++)
     {
         for (int z = 0; z < Matrix_Size.z; z++)
         {
             Transform T_Cell_in_grid;
             T_Cell_in_grid = GridArra[x, z];
             NavMazeBlock cScript = T_Cell_in_grid.GetComponent <NavMazeBlock>();
             cScript._g = 0;
             cScript._H = 0;
             cScript._F = 0;
         }
     }
 }
コード例 #5
0
ファイル: MazeManager.cs プロジェクト: nablam/PowderHouseDev
    void populate_H()
    {
        for (int x = 0; x < Matrix_Size.x; x++)
        {
            for (int z = 0; z < Matrix_Size.z; z++)
            {
                Transform T_Cell_in_grid;
                T_Cell_in_grid = GridArra[x, z];
                NavMazeBlock cScript = T_Cell_in_grid.GetComponent <NavMazeBlock>();
                cScript._H = (Mathf.Abs(cScript.MyStupid__X - (int)EndNodeV3.x)) + (Mathf.Abs(cScript.MyStupid__Z - (int)EndNodeV3.z));

                //	cScript._H= myx-_endNodeX + myy- endy
            }
        }
    }
コード例 #6
0
ファイル: MazeManager.cs プロジェクト: nablam/PowderHouseDev
 void makeAdjList_and_Actualparent_AFTER_WALLSELECTION()
 {
     for (int x = 0; x < Matrix_Size.x; x++)
     {
         for (int z = 0; z < Matrix_Size.z; z++)
         {
             Transform T_Cell_in_grid;
             T_Cell_in_grid = GridArra[x, z];
             if (T_Cell_in_grid.GetComponent <NavMazeBlock>().IsLegitPath)
             {
                 NavMazeBlock cScript = T_Cell_in_grid.GetComponent <NavMazeBlock>();
                 //CHECK BOT
                 if (x - 1 >= 0)
                 {
                     cScript.Adjacent_list_Transforms.Add(GridArra[x - 1, z]);
                     //GridArra[x-1,z].GetComponent<NavMazeBlock>().ptrT_Parent=T_Cell_in_grid;
                     GridArra[x - 1, z].GetComponent <NavMazeBlock>().ptrT_ActualParent = T_Cell_in_grid;
                 }
                 //CHECK TOP
                 if (x + 1 < Matrix_Size.x)
                 {
                     cScript.Adjacent_list_Transforms.Add(GridArra[x + 1, z]);
                     //GridArra[x+1,z].GetComponent<NavMazeBlock>().ptrT_Parent=T_Cell_in_grid;
                     GridArra[x + 1, z].GetComponent <NavMazeBlock>().ptrT_ActualParent = T_Cell_in_grid;
                 }
                 //CHECK BRIGHT
                 if (z - 1 >= 0)
                 {
                     cScript.Adjacent_list_Transforms.Add(GridArra[x, z - 1]);
                     //GridArra[x,z-1].GetComponent<NavMazeBlock>().ptrT_Parent=T_Cell_in_grid;
                     GridArra[x, z - 1].GetComponent <NavMazeBlock>().ptrT_ActualParent = T_Cell_in_grid;
                 }
                 //CHECK LEFT
                 if (z + 1 < Matrix_Size.z)
                 {
                     cScript.Adjacent_list_Transforms.Add(GridArra[x, z + 1]);
                     //GridArra[x,z+1].GetComponent<NavMazeBlock>().ptrT_Parent=T_Cell_in_grid;
                     GridArra[x, z + 1].GetComponent <NavMazeBlock>().ptrT_ActualParent = T_Cell_in_grid;
                 }
             }
         } //Xforz
     }     //Xforx
 }         //XSetAdj
コード例 #7
0
ファイル: MazeManager.cs プロジェクト: nablam/PowderHouseDev
 void clearListOfAdjascent()
 {
     for (int x = 0; x < Matrix_Size.x; x++)
     {
         for (int z = 0; z < Matrix_Size.z; z++)
         {
             Transform T_Cell_in_grid;
             T_Cell_in_grid = GridArra[x, z];
             NavMazeBlock cScript = T_Cell_in_grid.GetComponent <NavMazeBlock>();
             if (cScript.ptrT_ActualParent != null)
             {
                 cScript.ptrT_ActualParent = null;
             }
             //cScript.ptrT_Parent_PATH=null;
             //cScript.ptrT_Parent=null;
             cScript.isfound = false;
             cScript.Adjacent_list_Transforms.Clear();
             //	T_Cell_in_grid.GetComponent<Renderer>().material.color=Color.cyan;
             //cScript._F = cScript._H+ cScript._G ;
             //T_Cell_in_grid.name= "("+ cScript.MyStupid__X  + "," + cScript.MyStupid__Z+ ")" + "g."+ cScript._G + "h."+cScript._H + "f." + cScript._F;
         }
     }
 }