Exemplo n.º 1
0
 void ShootWeapon(Transform[] list, ObjectPoolerScriptableObject objectPooler, AudioClip sfx = null)
 {
     if (sfx != null)
     {
         SoundManager.Instance.PlaySound(sfx, list[0].position);
     }
     // Per ogni bocca di fuoco...
     foreach (Transform gunTransform in list)
     {
         // ... richiedo all'object pooler corrispondente un proiettile e...
         GameObject bullet = objectPooler.GetObject();
         // ... lo posiziono sulla bucca di fuoco
         bullet.transform.position = gunTransform.position;
         Quaternion rotation = Quaternion.Euler(0, gunTransform.rotation.eulerAngles.y, 0);
         bullet.transform.rotation = rotation;
     }
 }