Пример #1
0
 public bool continueCombo(ComboInput i)
 {
     if (inputs[currentInput].isSameAs(i))
     {
         currentInput++;
         if (currentInput >= inputs.Count)
         {
             onInputted.Invoke();
             currentInput = 0;
         }
         return(true);
     }
     else
     {
         currentInput = 0;
         return(false);
     }
 }
Пример #2
0
        private void Update()
        {
            if (currentAttack != null)
            {
                if (timer > 0)
                {
                    timer -= Time.deltaTime;
                }
                else
                {
                    currentAttack = null;
                }

                return;
            }

            if (currentCombos.Count > 0)
            {
                leeway += Time.deltaTime;
                if (leeway >= timeBetweenAttacks)
                {
                    if (lastInput != null)
                    {
                        Attack(getAttackFromType(lastInput.type));
                        lastInput = null;
                    }
                    ResetCombos();
                }
            }
            else
            {
                leeway = 0f;
            }

            if (input == null)
            {
                return;
            }
            lastInput = input;

            List <int> remove = new List <int>();

            for (int i = 0; i < currentCombos.Count; i++)
            {
                Combo c = combos[currentCombos[i]];
                if (c.continueCombo(input))
                {
                    leeway = 0f;
                }
                else
                {
                    remove.Add(i);
                }
            }

            if (skip)
            {
                skip = false;
                return;
            }

            for (int i = 0; i < combos.Count; i++)
            {
                if (currentCombos.Contains(i))
                {
                    continue;
                }
                if (combos[i].continueCombo(input))
                {
                    currentCombos.Add(i);
                    leeway = 0f;
                }
            }

            foreach (int i in remove)
            {
                currentCombos.RemoveAt(i);
            }

            if (currentCombos.Count <= 0)
            {
                Attack(getAttackFromType(input.type));
            }
        }
Пример #3
0
 private void HeavyAttack(InputAction.CallbackContext context)
 {
     input = new ComboInput(AttackType.heavy);
     playerAnim.SetTrigger("heavyAttack");
     Debug.Log("Heavy Attack");
 }
Пример #4
0
 public bool isSameAs(ComboInput test)
 {
     return(type == test.type);
 }
Пример #5
0
 private void LightAttack(InputAction.CallbackContext context)
 {
     input = new ComboInput(AttackType.light);
     playerAnim.SetTrigger("lightAttack");
     Debug.Log("Light Attack");
 }