예제 #1
0
파일: Hero.cs 프로젝트: Nypsyy/Discere
    private void UpdateAttackMagicHeavy()
    {
        if (_heavyAttack && _magicLaserInstance is null)
        {
            if (!_mana.HasEnough(magicHeavyManaCost))
            {
                return;
            }
            _magicLaserInstance = Instantiate(magicLaserPrefab, transform.position, Quaternion.identity, transform).GetComponent <Laser>();
            _audio.Play(Sounds.LaserBuildup);
        }

        if (_heavyAttackRelease && _magicLaserInstance)
        {
            if (_magicLaserInstance.IsReady)
            {
                _mana.UseMana(magicHeavyManaCost);
                _magicLaserInstance.Shoot();

                anim.SwitchMode(HeroMode.Slash);
                anim.SetModeSpeed(3);

                _audio.Play(Sounds.LaserShoot);
            }
            else
            {
                _magicLaserInstance.Cancel();
            }

            _magicLaserInstance = null;
            _audio.Stop(Sounds.LaserBuildup);
        }

        if (_magicLaserInstance is null || _magicLaserInstance.IsShooting)
        {
            return;
        }
        anim.UpdateDirection(ShootingDirection);
        anim.UpdateSlashDirection(ShootingDirection);
    }