public void Fire(AttackerData attacker)
 {
     if (Time.time >= _nextShotTime)
     {
         _nextShotTime = Time.time + interval;
         SendProjectile(attacker);
     }
 }
        private void SendProjectile(AttackerData attacker)
        {
            Bullet bullet = Instantiate(_bulletPrefab, _bulletSpawnTransform.position, _bulletSpawnTransform.rotation);

            bullet.ChangeSpeed(bulletSpeed);
            bullet.DestroyWithDelay(bulletLifetime);

            AttackProjectileSetter attackerProjectilSetter = bullet.GetComponent <AttackProjectileSetter>();

            if (!attackerProjectilSetter)
            {
                return;
            }

            attackerProjectilSetter.SetAttacker(attacker);
        }
Ejemplo n.º 3
0
 public void Fire(AttackerData attacker)
 {
     isActive = true;
 }
 public void SetAttacker(AttackerData attackerData)
 {
     _meshRenderer.material = attackerData.material;
     gameObject.layer       = LayerMask.NameToLayer(attackerData.layerName);
 }