Пример #1
0
    void Shoot(string button)
    {
        _isCasting = true;
        Skill currentSkill = null;
        bool  isOnCoolDown = true;

        switch (button)
        {
        case "Fire1":
        {
            currentSkill = _currentLeftSkill;
            isOnCoolDown = _skillManager.IsOnCooldown(true);
            break;
        }

        case "Fire2":
        {
            currentSkill = _currentRightSkill;
            isOnCoolDown = _skillManager.IsOnCooldown(false);
            break;
        }

        case "Motion1":
        {
            currentSkill = _currentShiftSkill;
            isOnCoolDown = _skillManager.IsShiftOnCooldown();
            break;
        }
        }

        if (!isLocalPlayer || currentSkill == null || isOnCoolDown)
        {
            _isCasting = false;
            return;
        }

        if (_lastColorCoroutine != null)
        {
            StopCoroutine(_lastColorCoroutine);
        }
        _lastColorCoroutine = StartCoroutine(GlowShards(Mathf.Clamp(currentSkill.CastTime - 0.275f, 0f, currentSkill.CastTime), currentSkill.Color));
        Debug.Log(currentSkill.Name);
        _skillManager.Cast();

        var delay = currentSkill.FireRate == 0 ? 0 : 1 / currentSkill.FireRate;

        StartCoroutine(ShootFewTimes(
                           currentSkill.Charges, currentSkill.Slowdown, currentSkill.CastTime, delay,
                           button, _skillManager.FirePoint, currentSkill.Name, currentSkill.Velocity,
                           currentSkill.Damage, currentSkill.Force, currentSkill.DestroyAfterSeconds));

        switch (button)
        {
        case "Fire1":
        {
            _skillManager.ReloadLeft();
            break;
        }

        case "Fire2":
        {
            _skillManager.ReloadRight();
            break;
        }

        case "Motion1":
        {
            _skillManager.ReloadShift();
            break;
        }
        }
    }
Пример #2
0
 public override void TriggerAbility(GameObject obj, int userID)
 {
     skillManager = obj.GetComponent <SkillManager>();
     skillManager.Cast(leadUpSkill, castTime);
 }