Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (this.expireTimer > 0f)
     {
         this.expireTimer -= Time.deltaTime;
     }
     else
     {
         BulletPool.Reclaim(this.gameObject);
     }
 }
Esempio n. 2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Car"))
     {
         var bulletOwnerID = this.owner.GetComponent <PlayerMovement>().id;
         var otherID       = other.gameObject.GetComponent <PlayerMovement>().id;
         if (bulletOwnerID == otherID)
         {
             return;
         }
         //deal damage, reclaim to pool, launch particles etc.
         var playerMovement = other.gameObject.GetComponent <PlayerMovement>();
         playerMovement.stats.ReduceHealth(this.damage);
         BulletPool.Reclaim(this.gameObject);
     }
 }