예제 #1
0
파일: SolveInput.cs 프로젝트: SSSSShark/May
    private void Awake()
    {
        locked = 0;
        grid   = GameObject.FindWithTag("Grid").GetComponent <HexGrid>();
        //于沛琦加,绑定地图探索text
        MapExplore            = GameObject.FindWithTag("MapExplore").GetComponent <Text>();
        ExplorePic            = GameObject.FindWithTag("ExplorePic").GetComponent <Image>();
        ExplorePic.fillAmount = 0.0f;
        //于沛琦加end
        //方政言加,为实现网格内容探测
        gridcontent = GameObject.FindWithTag("Grid").GetComponent <GridContent>();
        //方政言加end
        camera = GameObject.FindWithTag("MainCamera").GetComponent <CameraController>();
        if (camera == null)
        {
            Debug.Log("camera not set");
        }

        myInput = camera.GetComponent <MyInput>();
        //设定初始格,并修改颜色
        int index;

        //for (int i = 0; i < grid.height; i++)
        //{
        //    if (i == 0 || i == grid.height - 1)
        //    {
        //        for (int j = 0; j < grid.width; j++)
        //        {
        //            index = i * grid.height + j;
        //            Cell = grid.cells[index];
        //            Cell.color = grid.CellColor[4];
        //            grid.hexMesh.Triangulate(grid.cells);
        //        }
        //    }
        //    else
        //    {
        //        index = i * grid.height;
        //        Cell = grid.cells[index];
        //        Cell.color = grid.CellColor[4];
        //        grid.hexMesh.Triangulate(grid.cells);
        //        index = (i + 1) * grid.height - 1;
        //        Cell = grid.cells[index];
        //        Cell.color = grid.CellColor[4];
        //        grid.hexMesh.Triangulate(grid.cells);
        //        grid.hexMesh.Triangulate(grid.cells);
        //    }
        //}
        index             = 2 + 5 * grid.width + 5 / 2;
        CurrentCell       = grid.cells[index];
        CurrentCell.color = grid.CellColor[1];
        grid.hexMesh.Triangulate(grid.cells);
        UpdateArround(CurrentCell, CurrentCellAround, CurrentTextAround);
        PrintArround(grid.CellColor[2], CurrentCellAround);

        playerPos = grid.cells[index].transform.position;
        //方政言加,为实现网格内容探测
        CurrentText = index;
        gridcontent.start(CurrentText, CurrentTextAround);
        gridcontent.detectAround(CurrentTextAround);
        viewportalflag = false;
        viewsiflag     = false;
        //方政言加end
    }