private void CreateBulletPool() { GameObject _bul = Instantiate(projectilePrefab.gameObject, transform.position, Quaternion.identity, bulletsParent.transform); _bul.SetActive(false); MinigunBulletBehaviour _behav = _bul.GetComponent <MinigunBulletBehaviour>(); bulletPool.Enqueue(_behav); }
public override void Fire(PhotonMessageInfo info) { float lag = (float)(PhotonNetwork.Time - info.SentServerTime); MinigunBulletBehaviour _shot = bulletPool.Dequeue(); _shot.gameObject.SetActive(true); _shot.FireBullet(pb, sbb.GetCannonPlace.transform.position + sbb.GetCannonPlace.transform.right, Quaternion.LookRotation(pb.SubMesh.transform.right, pb.SubMesh.transform.up), lag); bulletPool.Enqueue(_shot); }