コード例 #1
0
    // Update is called once per frames
    void Update()
    {
        int[] arr = new int[] {
            0, 4, 5, 4, 5, 0,
            0, 3, 3, 3, 4, 0,
            0, 2, 2, 2, 3, 0,
            1, 0, 0, 2, 0, 0
        };
        if (Time.time >= _creatTargetTime && flag < 24)
        {
            int idx = Random.Range(0, 5);
            int x   = Random.Range(0, GameConfig.GAMECOLUMN);

            GameObject temp = Instantiate(_block);
            temp.GetComponent <BlockAni>().setPosByArrIdx(flag % 6, GameConfig.GAMEROW - 1);
            temp.GetComponent <BlockAni>()._curState = (BlockAni.BlockState.TopDown);
            temp.GetComponent <BlockAni>()._lastPos  = new Vector2(flag % 6, GameConfig.GAMEROW - 1);
            temp.GetComponent <BlockAni>()._picidx   = arr[flag];

            _creatTargetTime = Time.time + _newBlcokDur;
            _arrAllBlock.Add(temp);

            flag++;
        }

        _curState.StateUpdate();
        HandleInput();
        ComboMgr.getInstance().updata(Time.deltaTime);
        tryDelBlocks();
    }