Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        var _constants = BGameConstants.getInstance();

        fieldVisual = new BTetrisTransform[_constants.height, _constants.depth, _constants.width];
        constructColumns();
    }
Exemplo n.º 2
0
    protected virtual void Awake()
    {
        var _constants = BGameConstants.getInstance();

        field            = new TetrisField(_constants.width, _constants.depth, _constants.height);
        field.tetrisGrid = tetrisGrid;
    }
Exemplo n.º 3
0
    bool canMoveWall(BTetrisTransform tetrimino, Vector3 direction)
    {
        var _constants = BGameConstants.getInstance();
        var d          = direction.normalized;
        var bound      = tetrimino.getBound();

        if (d.x > 0)
        {
            return(bound.right < _constants.width - 1);
        }
        if (d.x < 0)
        {
            return(bound.left > 0);
        }
        if (d.y > 0)
        {
            return(bound.up < _constants.height - 1);
        }
        if (d.y < 0)
        {
            return(bound.down > 1);
        }
        if (d.z > 0)
        {
            return(bound.back < _constants.depth - 1);
        }
        if (d.z < 0)
        {
            return(bound.forward > 0);
        }
        return(true);
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        var _constants = BGameConstants.getInstance();

        this.tickInterval = _constants.startSpeed;
        StartCoroutine(tick());
        this.movingPiece = this.getNextBrick();
    }
Exemplo n.º 5
0
    public virtual BTetrisTransform getNextBrick()
    {
        var _constants = BGameConstants.getInstance();

        return(builder.createRandomBrick(new Vector3(
                                             Mathf.Ceil((1.0f * _constants.width) / 2),
                                             _constants.height,
                                             Mathf.Ceil((1.0f * _constants.depth) / 2)
                                             )
                                         ));
    }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        var _constant = BGameConstants.getInstance();

        titleLabel.text       = _constant.gameName + " " + _constant.versionName;
        titleLabel2.text      = _constant.gameName + " " + _constant.versionName;
        buildNumberLabel.text = "Build " + _constant.buildNumber.ToString("0000");
        this.panels.ToList().ForEach((panel) =>
        {
            panel.GetComponent <BSlideInOut>().init();
        });
    }
Exemplo n.º 7
0
    void constructColumns()
    {
        var  _constants = BGameConstants.getInstance();
        bool alt        = false;

        for (int x = 0; x < _constants.width; x++)
        {
            alt = !alt;
            for (int z = 0; z < _constants.depth; z++)
            {
                constructColumn(x, z, _constants.height, (alt? columnAltPrefab : columnPrefab));
                alt = !alt;
            }
        }
    }
    public override BTetrisTransform getNextBrick()
    {
        var _constants = BGameConstants.getInstance();

        forceBricksProgress = forceBricksProgress % forceBricks.Length;
        var configName = forceBricks[forceBricksProgress++];

        print(configName);
        var newBrick = this.builder.createBrick(configName, new Vector3(_constants.width / 2, _constants.height, _constants.depth / 2));

        var shapeIndex = Mathf.Min(startShape, newBrick.tetriminoConfig.config.Length - 1);

        newBrick.setRotation(shapeIndex);

        return(newBrick);
    }
Exemplo n.º 9
0
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);
    }
Exemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     this._constants = BGameConstants.getInstance();
 }