/// <summary> /// ゲームを開始します。 /// </summary> public void Play() { if (this.IsPlaying.Value) { return; } this.PreviousCount = 0; this.nextTetrimino.Value = Tetrimino.RandomKind(); this.Field.Activate(Tetrimino.RandomKind()); this.Result.Clear(); }
/// <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(); } //--- 新しいテトリミノを設定 var kind = this.nextTetrimino.Value; this.nextTetrimino.Value = Tetrimino.RandomKind(); this.Field.Tetrimino.Value = Tetrimino.Create(kind); }); this.Field.LastRemovedRowCount.Subscribe(this.Result.AddRowCount); }