Exemplo n.º 1
0
    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;
    }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
    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;
    }
Exemplo n.º 4
0
    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);
    }