コード例 #1
0
    void Awake()
    {
        // initialize
        gdController   = GameDataController.Instance;
        generationSize = (int)(MapGenerator.Instance.ChunkSize / 2);
        vfRenderer     = GetComponent <MeshRenderer>();

        // set lists capacity
        allBlocks.Capacity     = (2 * generationSize + 1) * (2 * generationSize + 1) * MAP_HEIGHT;
        meshVertices.Capacity  = 24 * (2 * generationSize + 1) * (2 * generationSize + 1) * MAP_HEIGHT;
        meshTriangles.Capacity = 6 * (2 * generationSize + 1) * (2 * generationSize + 1) * MAP_HEIGHT;
        meshUV.Capacity        = 4 * (2 * generationSize + 1) * (2 * generationSize + 1) * MAP_HEIGHT;

        // load player blocks
        playerBlocks = gdController.GetPlayerBlocks(transform.position);

        for (int i = 0; i < playerBlocks.Count; i++)
        {
            allBlocks[playerBlocks.Keys[i]] = playerBlocks.Values[i];
        }
    }