public void InvokeShoot(ShootingMetadata metaData) { _bulletOwner = metaData.Player; this._direction = metaData.Direction - transform.position; isInvoked = true; StartCoroutine(HideBullet()); }
private void Start() { _playerAim = GetComponent <PlayerAim>(); _shootButton = FindObjectOfType <ButtonEvent>(); _shootButton.OnShoot.AddListener(Shoot); _ammoText = GameObject.FindGameObjectWithTag("AmmoInfo").GetComponent <TextMeshProUGUI>(); _objectPoolManager = FindObjectOfType <ObjectPoolManager>(); _shootingMetadata = new ShootingMetadata(); UpdateAmmoText(); }
public GameObject SpawnFromPool(NetworkObjectPoolTag tag, Vector3 position, Quaternion rotation, ShootingMetadata shootingMetadata) { var obj = SpawnFromPool(tag, position, rotation); obj.GetComponent <BulletBehaviour>().InvokeShoot(shootingMetadata); return(obj); }