コード例 #1
0
    /// <summary>
    /// Creates the block. Using playing coord [1, +INF)
    /// </summary>
    /// <returns>The block.</returns>
    /// <param name="x">The x coordinate.</param>
    /// <param name="y">The y coordinate.</param>
    /// <param name="size">Size.</param>
    MapBlock CreateBlock(int x, int y, int size)
    {
        GameObject g = Instantiate(blockPrefab,
                                   transform.position + new Vector3(x * unitDist, -y * unitDist, 0),
                                   Quaternion.identity);

        g.name = System.String.Format("MapBlock({0}, {1}, {2}x{2})", x, y, size);

        MapBlock block = g.GetComponentInChildren <MapBlock>();

        block.posX = x;
        block.posY = y;
        block.SetSize(size);
        blocks.Add(block);

        block.transform.localScale = new Vector3(unitDist, unitDist, unitDist);
        block.transform.SetParent(blockParent);

        return(block);
    }