예제 #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");
 }