Ejemplo n.º 1
0
        /// <summary>
        /// ゲームを開始します。
        /// </summary>
        public void Play()
        {
            if (this.IsPlaying.Value)
            {
                return;
            }

            this.PreviousCount = 0;
            if (Mode == GameMode.CRAZY)
            {
                TetriminoExtensions.SetRandomPattern();
                this.nextTetrimino.Value = TetriminoKind.RANDOM;
                //TetriminoExtensions.SetRandomPattern();
                this.Field.Activate(TetriminoKind.RANDOM);
            }
            else
            {
                this.nextTetrimino.Value = Tetrimino.RandomKind();
                this.Field.Activate(Tetrimino.RandomKind());
            }
            this.Result.Clear();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// インスタンスを生成します。
        /// </summary>
        public Game()
        {
            this.Field.PlacedBlocks.Subscribe(_ =>
            {
                //--- 10 行消すたびにスピードアップ
                var count = this.Result.TotalRowCount.Value / 10;
                if (count > this.PreviousCount)
                {
                    this.PreviousCount = count;
                    this.Field.SpeedUp();
                }

                //--- 新しいテトリミノを設定
                if (Mode == GameMode.CRAZY)
                {
                    var kind = this.nextTetrimino.Value;
                    if (this.nextTetrimino.Value == TetriminoKind.NEXTRANDOM)
                    {
                        TetriminoExtensions.SetRandomPattern();
                        this.nextTetrimino.Value = TetriminoKind.RANDOM;
                    }
                    else
                    {
                        TetriminoExtensions.SetNextRandomPattern();
                        this.nextTetrimino.Value = TetriminoKind.NEXTRANDOM;
                    }
                    this.Field.Tetrimino.Value = Tetrimino.Create(kind);
                }
                else
                {
                    var kind = this.nextTetrimino.Value;
                    this.nextTetrimino.Value   = Tetrimino.RandomKind();
                    this.Field.Tetrimino.Value = Tetrimino.Create(kind);
                }
            });
            this.Field.LastRemovedRowCount.Subscribe(this.Result.AddRowCount);
        }