public void ShootPattern(string patternName, Vector2?position = null, float?direction = null)
    {
        if (_bulletEmitters.Count == 0)
        {
            Debug.LogWarning("No bullet emitter found for this boss!");
        }

        var pattern = _bulletManager.GetPattern(patternName);

        if (position.HasValue)
        {
            var bullet = (Bullet)_bulletManager.CreateBullet(true);

            if (bullet != null)
            {
                bullet.SetPosition(position.Value);

                if (direction.HasValue)
                {
                    bullet.SetDirection(direction.Value);
                }

                bullet.InitTopNode(pattern.RootNode);
            }
        }
        else
        {
            foreach (var bulletEmitter in _bulletEmitters)
            {
                bulletEmitter.SetPattern(pattern);
                bulletEmitter.AddBullet();
            }
        }
    }
Beispiel #2
0
    //создание пуль для выстрела
    public virtual void Bullet_making()
    {
        GameObject bullet = BulletManager.CreateBullet(typeGun);

        if (bullet == null)
        {
            bullet = Instantiate(Bullet);
        }
        Bullet bull = bullet.GetComponent <Bullet>();

        bull.Damage = Damage;
        bull.Shoot(typeGun, Barrel.transform.position, Vector, SpeedBullet, Distans);
        bullet.SetActive(true);
        recoil(Recoil / 2 * Random.Range(-1f, 1f));
    }