// Update is called once per frame
    //void Update()
    //{
    //}

    #region Logic ball

    public void InitBalls(LevelProfile level)
    {
        if (_gridManager == null)
        {
            _gridManager = new GridManager(8, 14, 120, 100);

            if (level is ProceduralLevelProfile)
            {
                _secondaryGridManager = new GridManager(8, 14, 120, 100, new Vector2(0, -_gridManager.GetCellSizeY() / 2 * 27 - _gridManager.GetCellSizeY() / 2.0f));
            }

            _numberOfInitRow   = level.GetInitRow();
            _numberOfDiffColor = level.GetNumColor();
        }

        for (int i = 0; i < _gridManager.GetGridSizeX(); i++)
        {
            for (int j = 0; j < _numberOfInitRow; j++)
            {
                if (_gridManager.IsValidGridPosition(i, j))
                {
                    Ball ball = instantiateNewBall(randomBallColor(_numberOfDiffColor + 1));
                    assignBallToGrid(ball, i, j);
                    ball.FixPosition();
                }
            }
        }
    }
예제 #2
0
    public void InitBalls(LevelProfile level)
    {
        if (_gridManager == null)
        {
            _gridManager       = new GridManager(7, 14, 120, 100);
            _numberOfInitRow   = level.GetInitRow();
            _numberOfDiffColor = level.GetNumColor();
        }

        for (int i = 0; i < _gridManager.GetGridSizeX(); i++)
        {
            for (int j = 0; j < _numberOfInitRow; j++)
            {
                if (_gridManager.IsValidGridPosition(i, j))
                {
                    Ball ball = instantiateNewBall(randomBallColor(_numberOfDiffColor + 1));
                    assignBallToGrid(ball, i, j);
                    ball.FixPosition();
                }
            }
        }
    }