1
using System
.Collections
;
2 using System
.Collections
.Generic
;
5 public class GrenadeExplosion
: MonoBehaviour
{
8 public int explosiveDelay
;
10 public Transform explosion
;
13 // Use this for initialization
17 StartCoroutine (Explode ());
20 // Update is called once per frame
25 IEnumerator
Explode(){
26 yield return new WaitForSeconds (explosiveDelay
);
27 Instantiate (explosion
, transform
.position
, transform
.rotation
);
31 private void OnCollisionEnter2D(Collision2D col
)
33 if (col
.gameObject
.tag
== "YarnPhysics")
35 col
.gameObject
.GetComponent
<HealthSlider
>().BulletDamage(this.tag
, this.transform
.position
, this.gameObject
);
36 Instantiate(explosion
, transform
.position
, transform
.rotation
);
38 Destroy(this.gameObject
);
40 else if (col
.gameObject
.tag
== "YarnABullet" || col
.gameObject
.tag
== "YarnBBullet" || col
.gameObject
.tag
== "YarnCBullet")
42 Instantiate(explosion
, transform
.position
, transform
.rotation
);
44 Destroy(this.gameObject
);
45 Destroy(col
.gameObject
);