Beispiel #1
0
    public void Shoot()
    {
        if (Time.time >= nextTimeToFire)
        {
            nextTimeToFire = Time.time + 1 / fireRate;
            var bullet = _bulletSpawner.SpawnBullet(_spawnRight);
            bullet.bulletBehaviour = _bB;
            bullet.bulletBehaviour.Initialize(_spr, bullet);

            bullet = _bulletSpawner.SpawnBullet(_spawnLeft);
            bullet.bulletBehaviour = _bB;
            bullet.bulletBehaviour.Initialize(_spr, bullet);
        }
    }
Beispiel #2
0
    public void Enter()
    {
        if (canShoot)
        {
            _bullet = _bulletSpawner.SpawnBullet(_spawn);
            _bullet.bulletBehaviour = _bB;

            _bullet.bulletBehaviour.Initialize(_spr, _bullet);

            canShoot = false;
        }
    }