Exemplo n.º 1
0
 private AttackBox FindAttack(AttackInputInfo info)
 {
     return(AttackBoxs
            .Where(n => n.attackInputInfo.keyCodes.Count == info.keyCodes.Count)
            .Where(n => n.attackInputInfo.applyPhase == ApplyPhase.Both || n.attackInputInfo.applyPhase == info.applyPhase)
            .Where(n => n.attackInputInfo.commandType == info.commandType)
            .ToList()
            .Find(n => n.attackInputInfo.keyCodes.OrderBy(v => v)
                  .SequenceEqual(info.keyCodes.OrderBy(w => w))));
 }
Exemplo n.º 2
0
        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;
        }