Beispiel #1
0
 public void Fire()
 {
     if (ammo > 0)
     {
         GameObject bullet = null;
         for (int i = 0; i < BulletPool.Count; i++)
         {
             if (!BulletPool[i].activeInHierarchy)
             {
                 bullet = BulletPool[i];
                 break;
             }
         }
         if (bullet != null)
         {
             bullet.transform.rotation = playerController.GetPlayerLookRotation();
             bullet.transform.position = playerController.GetPlayerForward() + spawnHeightVector + playerController.GetPlayerPosition() * spawnDistance;
             bullet.SetActive(true);
         }
     }
 }