Esempio n. 1
0
    public void ReCreateGound(int width, int height)
    {
        DestroyAll();

        w      = width;
        h      = height;
        blocks = new Block[w, h];
        offset = new Vector3((w - 1) * BlockSize.x / 2, (h - 1) * BlockSize.y / 2, 0);
        Utils.For(w, h, (x, y) =>
        {
            var b = Instantiate(BlockTemplate) as Block;
            b.gameObject.SetActive(true);
            b.Layer = 0;
            b.transform.SetParent(transform, false);
            b.transform.localPosition = ToWorldPos(x, y);
            blocks[x, y] = b;
        });

        pathFinder.ResetMapData(new int[w * h], w, h);

        Player.Move2(0, 0);
    }