public void OnBulletSpawn(Vector3 velcoity, float maxVelocity, TankFiring tankFiring, int numberOfBounces) { NumberOfBounces = numberOfBounces; owner = tankFiring; owner.AddBullet(); rb.velocity = velcoity; bulletVelocity = maxVelocity; effect = Instantiate(smoke, transform); effect.Play(); checkVelocity = true; }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { if (other.GetComponent <TankController>()) { TankFiring tankControlFire = other.GetComponent <TankFiring>(); tankControlFire.AddAmount(AmountValue); tankControlFire.ammoInfo = GameObject.FindGameObjectWithTag("Ammo").GetComponent <Text>(); tankControlFire.ammoInfo.text = "Ammo : " + tankControlFire.amount; } NetworkServer.Destroy(gameObject); PowerUpsManager.Instance.RemovePowerUp(gameObject); } }
public void OnBulletDespawn() { if (owner != null) { owner.RemoveBullet(); owner = null; } rb.velocity = Vector3.zero; bulletVelocity = 0f; currentBounces = 0; effect.Stop(); effect.transform.parent = null; checkVelocity = false; }
public GameObject SpawnFromPool(Vector3 position, Quaternion rotation, Vector3 velocity, float maxVelocity, TankFiring tankFiring, int numberOfBounces) { GameObject bullet = bulletQueue.Dequeue(); bullet.SetActive(true); bullet.transform.position = position; bullet.transform.rotation = rotation; bullet.GetComponent <BulletCollider>().OnBulletSpawn(velocity, maxVelocity, tankFiring, numberOfBounces); return(bullet); }