/// <summary> /// コマンド実行 /// </summary> public override void ExecuteCommand(PlayerController.CommandData command) { switch ((PlayerController.CommandType)command.type) { case PlayerController.CommandType.TR_Move: if (command.values != null) { (Game as TRGame).PlayArea.MoveTetromino(new Vector2i(command.values[0], command.values[1])); } break; case PlayerController.CommandType.TR_Rotate: if (command.values != null) { (Game as TRGame).PlayArea.RotateTetromino(command.values[0] == 1); } break; case PlayerController.CommandType.TR_Hold: (Game as TRGame).PlayArea.Hold(); break; } // ダメージ DamageTable.DamageData damage = GetDamageData((PlayerController.DamageType)command.damageType, command.damageValue); if (damage != null) { (Game as TRGame).PlayArea.RequestAddLine((int)damage.TRLine); } }
/// <summary> /// プル /// </summary> private void PullDrop(sbyte row) { PlayerController.CommandData command = new PlayerController.CommandData(); command.type = (byte)PlayerController.CommandType.MD_Pull; command.values = new sbyte[1]; command.values[0] = row; SetNextCommand(command); }
/// <summary> /// テトロミノ回転 /// </summary> private void RotateTetromino(bool negative) { PlayerController.CommandData command = new PlayerController.CommandData(); command.type = (byte)PlayerController.CommandType.TR_Rotate; command.values = new sbyte[1]; command.values[0] = (sbyte)(negative ? 1 : 0); SetNextCommand(command); }
/// <summary> /// テトロミノ移動 /// </summary> private void MoveTetromino(Vector2i targetGrid) { PlayerController.CommandData command = new PlayerController.CommandData(); command.type = (byte)PlayerController.CommandType.TR_Move; command.values = new sbyte[2]; command.values[0] = (sbyte)targetGrid.x; command.values[1] = (sbyte)targetGrid.y; SetNextCommand(command); }
/// <summary> /// パネル入れ替え /// </summary> private void SwapPanel(PPPanelBlock block, PlayAreaBlock.Dir dir) { PlayerController.CommandData command = new PlayerController.CommandData(); command.type = (byte)PlayerController.CommandType.PP_Swap; command.values = new sbyte[2]; Vector2i grid = (Game as PPGame).PlayArea.GetBlockGrid(block); command.values[0] = (sbyte)(grid.y * PPGame.Config.PlayAreaWidth + grid.x); command.values[1] = (sbyte)dir; SetNextCommand(command); }
/// <summary> /// コマンド実行 /// </summary> public override void ExecuteCommand(PlayerController.CommandData command) { PPPlayArea playArea = (Game as PPGame).PlayArea; switch ((PlayerController.CommandType)command.type) { case PlayerController.CommandType.PP_Swap: if (command.values != null) { Vector2i grid = new Vector2i(command.values[0] % PPGame.Config.PlayAreaWidth, command.values[0] / PPGame.Config.PlayAreaWidth); PPPanelBlock result = playArea.SwapPanel(playArea.GetBlock(grid), (PlayAreaBlock.Dir)command.values[1]); if (result != null) { m_TouchedBlock = result; } } break; case PlayerController.CommandType.PP_Add: playArea.ElevateValue = PPGame.Config.ManualElevateSpeed; playArea.MaxElevateWaitTime = PPGame.Config.ManualElevateInterval; playArea.SkipElevateWait(); break; } // ダメージ DamageTable.DamageData damage = GetDamageData((PlayerController.DamageType)command.damageType, command.damageValue); if (damage != null) { foreach (var disturbData in damage.PPDisturb) { for (int i = 0; i < disturbData.count; i++) { (Game as PPGame).PlayArea.CreateDisturbPanel(disturbData.width, disturbData.height); } } } }
/// <summary> /// コマンド実行 /// </summary> public override void ExecuteCommand(PlayerController.CommandData command) { switch ((PlayerController.CommandType)command.type) { case PlayerController.CommandType.MD_Push: if (command.values != null) { m_CurrentRow = command.values[0]; UpdatePosition(); (Game as MDGame).PlayArea.PushDrop(m_CurrentRow); } break; case PlayerController.CommandType.MD_Pull: if (command.values != null) { m_CurrentRow = command.values[0]; UpdatePosition(); (Game as MDGame).PlayArea.PullDrop(m_CurrentRow); } break; case PlayerController.CommandType.MD_Add: (Game as MDGame).PlayArea.AddNewLine(); break; } // ダメージ DamageTable.DamageData damage = GetDamageData((PlayerController.DamageType)command.damageType, command.damageValue); if (damage != null) { for (int i = 0; i < (int)damage.MDLine; i++) { (Game as MDGame).PlayArea.AddNewLine(); } } }
/// <summary> /// ライン追加 /// </summary> private void AddLine() { PlayerController.CommandData command = new PlayerController.CommandData(); command.type = (byte)PlayerController.CommandType.MD_Add; SetNextCommand(command); }
/// <summary> /// ホールド /// </summary> private void HoldTetromino() { PlayerController.CommandData command = new PlayerController.CommandData(); command.type = (byte)PlayerController.CommandType.TR_Hold; SetNextCommand(command); }
/// <summary> /// コマンド実行 /// </summary> public virtual void ExecuteCommand(PlayerController.CommandData command) { }
/// <summary> /// コマンド登録 /// </summary> public virtual void SetNextCommand(PlayerController.CommandData command) { m_NextCommand = command; }