Exemple #1
0
 public void Reset()
 {
     IsGameover = false;
     DownTerm   = 1;
     ChangeScore(0);
     NextBlockGroup = BlockGroupInfo.GetRandomBlock();
 }
    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);
    }
    private void Centering(BlockGroupInfo info)
    {
        var width  = prefab.rectTransform.rect.width;
        var height = prefab.rectTransform.rect.height;

        if (info.GroupType == BlockShapeType.S ||
            info.GroupType == BlockShapeType.Z ||
            info.GroupType == BlockShapeType.T)
        {
            targetTransform.anchoredPosition = new Vector2(width / 2.0f, -height);
        }
        else if (info.GroupType == BlockShapeType.I)
        {
            targetTransform.anchoredPosition = new Vector2(width / 2.0f, -height / 4.0f);
        }
        else
        {
            targetTransform.anchoredPosition = new Vector2(0.0f, -height / 2.0f);
        }
    }
Exemple #4
0
 public void ChangeNextBlock()
 {
     GameContext.Instance.NextBlockGroup = BlockGroupInfo.GetRandomBlock();
     UIController.Instance.NextBlockUI.ChangeNextBlockGroup(GameContext.Instance.NextBlockGroup);
 }