Example #1
0
    void OnTriggerEnter2D(Collider2D col)
    {
        Laser laser = col.gameObject.GetComponent <Laser>();

        if (laser != null)
        {
            health -= laser.GetDamage();
            laser.Destroy();
        }
        if (health <= 50)
        {
            SpriteRenderer renderer = gameObject.GetComponent <SpriteRenderer> ();
            renderer.color = Color.red;
        }
        if (health <= 0)
        {
            Destroy(gameObject);
            Instantiate(particle, transform.position, Quaternion.identity);
        }
        jet.GainOneFire();
    }
Example #2
0
 void OnTriggerEnter2D(Collider2D col)
 {
     Destroy(col.gameObject);
     player.GainOneFire();
 }