Exemplo n.º 1
0
    private void Update()
    {
        //_currentlyUpdating = 0;
        foreach (Attack attack in _attacks)
        {
            attack.ManualUpdate();
            //++_currentlyUpdating;
        }

        PlayerControls controls = PlayerControls.Instance;

        if (_activeAttackID != -1)
        {
            if (!Input.GetKeyDown(controls.cancel))
            {
                return;
            }
            else
            {
                _attacks[_activeAttackID].StopCasting(true);
                _movement.RemoveModifier("Casting");
            }
        }

        for (int i = 0, length = _attacks.Length; i < length; ++i)
        {
            if (Input.GetKey(controls.abilities[i]))
            {
                if (CheckAndExecute(i))
                {
                    _movement.AddModifier(_attacks[i].GetMovementModifier());
                    _activeAttackID = i;
                    break;
                }
            }
        }
    }