public void InputKey(PlayerKeyCode player_key_code) { if (keyBuffer == player_key_code) { return; } Attack(player_key_code); keyBuffer = player_key_code; Observable.Timer(TimeSpan.FromSeconds(currentAttack?.bufferTime ?? keyBufferTime)) .Subscribe(_ => { keyBuffer = null; }); }
private void Attack(PlayerKeyCode player_key_code) { AttackBox result = null; var info = new AttackInputInfo(new List <PlayerKeyCode>() { player_key_code }, CurrentState, CurrentPhase); if (keyBuffer != null) { var duo_info = info; duo_info.keyCodes = new List <PlayerKeyCode>(info.keyCodes) { (PlayerKeyCode)keyBuffer }; result = FindAttack(duo_info); if (result != null) { foreach (var item in playerCancelProcesses.Where(i => !(i is AttackControll))) { item.Cancel(); } } } if (result == null) { if (currentAttack == null) { result = FindAttack(info); var str = result + ","; } else if (FindAttack(info) == currentRoot && currentAttack.HasNext && currentAttack.NextAttack().attackInputInfo.commandType != CommandType.Chain) { result = currentAttack.NextAttack(); } } if (currentAttack != null && currentAttack == result) { return; } if (result == null) { return; //ここでNullなら攻撃がないので非実行 } currentAttack?.ToolsCancel(); currentAttack = result; Observable .Timer(TimeSpan.FromSeconds(result.delayTimeForTools)) .Where(n => this.InAttack) .Subscribe(n => { if (result == currentAttack) { currentAttack.ToolsOn(); AttackEnable = true; } }); if (currentRoot == null) { currentRoot = result; } attackAnimControll.ChangeAnim(currentAttack); InAttack = true; }