示例#1
0
    public IEnumerator BlockGroupRoutine()
    {
        var group = BlockCreationService.GetNextBlock();

        currentDownTerm = 0.0f;

        if (GameContext.Instance.IsGameover || group == null)
        {
            yield break;
        }

        group.Initialize();

        while (group.IsFixed == false)
        {
            currentDownTerm += Time.deltaTime;
            if (currentDownTerm > GameContext.Instance.DownTerm)
            {
                currentDownTerm = 0.0f;
                group.Move(Vector2.down);
            }
            else
            {
                UpdateBlockGroup(group);
            }

            yield return(null);
        }

        CheckEraseLine();

        StartCoroutine(BlockGroupRoutine());
    }
    public void ChangeNextBlockGroup(BlockGroupInfo info)
    {
        Reset();

        Info = info;
        var posList = BlockCreationService.GetBlockLocalPosList(Info.GroupType);

        foreach (var pos in posList)
        {
            var x = pos.GetIntX() + 1;
            var y = pos.GetIntY() + 3;

            blocks[x, y].color = info.ColorType.ToColor().ToOpacity();
        }

        Centering(info);
    }