Ejemplo n.º 1
0
    private void Tap(Vector3 point)
    {
        //  陸地をチェック
        //Vector3 screenToWorldPointPosition = Camera.main.ScreenToWorldPoint(point);
        //Vector3Int cellPosition = GridMap.GetComponent<Grid>().LocalToCell(screenToWorldPointPosition);
        //var ret = GridMap.landArea( new Vector2Int(MapCtl.offset_tile2stg_x(cellPosition.x), MapCtl.offset_tile2stg_y(cellPosition.y)));
        //		LineRenderer lr = Instantiate(renderer);
        //
        //// 線の幅
        //lr.SetWidth(0.1f, 0.1f);
        //// 頂点の数
        //lr.SetVertexCount(ret.Count);
        //// 頂点を設定
        //for (int i=0;i<ret.Count;i++){
        //	lr.SetPosition(i, GridMap.GetComponent<Grid>().CellToLocal(new Vector3Int(MapCtl.offset_stg2tile_x(ret[i].x), MapCtl.offset_stg2tile_y(ret[i].y), 0)) + new Vector3(0f, 0f, -1f));
        //}

        // タップ時の処理を記述
        point.z = 10.0f;
        Vector3 screenToWorldPointPosition = Camera.main.ScreenToWorldPoint(point);
        //Grid grid = transform.parent.GetComponent<Grid>();
        Vector3Int cellPosition = GridMap.GetComponent <Grid>().LocalToCell(screenToWorldPointPosition);

        Debug.Log("[" + cellPosition.x + "," + cellPosition.y + "]");
        GridMap.ClickMap(cellPosition);

        var ret = GridMap.chkOpenSea(new Vector2Int(MapCtl.offset_tile2stg_x(cellPosition.x), MapCtl.offset_tile2stg_y(cellPosition.y)), 20, TileGroup.Sea);

        Debug.Log("[chkOpenSea = " + ret + "]");

        //if (count == 0) {
        //	spos = new Vector2Int(MapCtl.offset_tile2stg_x(cellPosition.x), MapCtl.offset_tile2stg_y(cellPosition.y));
        //    count=1;
        //
        //} else {
        //	epos = new Vector2Int(MapCtl.offset_tile2stg_x(cellPosition.x), MapCtl.offset_tile2stg_y(cellPosition.y));
        //	ast.getRoute(spos, epos, GridMap.tileMap, 2, TapCb); //A-Sterによる経路取得
        //	count=0;
        //}
    }