Exemple #1
0
    private void SetTetrominoDef(TetrominoDef tetrominoDef)
    {
        Vector3[] positions = TetrominoDef.GetPositions(tetrominoDef.TetrominoType);

        for (int i = 0; i < 4; i++)
        {
            Blocks[i].sprite             = tetrominoDef.BlockDefs[i].Sprite;
            Blocks[i].transform.position = transform.position + positions[i];
        }
    }
    public void SetTetrominoDef(TetrominoDef tetrominoDef)
    {
        Vector3[] positions = TetrominoDef.GetPositions(tetrominoDef.TetrominoType);

        for (int i = 0; i < 4; i++)
        {
            var block = Instantiate(BlockPrefab, transform.position + positions[i], Quaternion.identity, transform);
            block.SetBlockDef(tetrominoDef.BlockDefs[i]);

            Blocks[i] = block;
        }
    }