Ejemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        Unit        col   = collider.GetComponent <Unit>();
        BluegsPoint point = collider.GetComponent <BluegsPoint>();

        if (!point)
        {
            try
            {
                if (col && parent != col.gameObject)
                {
                    Destroy(gameObject);
                }
            }
            catch
            {
            }
            try
            {
                if (!col)
                {
                    Destroy(gameObject);
                }
            }
            catch { }
        }
    }
Ejemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D collider)
 {
     if (daying != 1)
     {
         Bullet bullet = collider.GetComponent <Bullet>();
         if (bullet)
         {
             dir = bullet.Direction;
             ReciveDamage();
         }
         BluegsPoint point = collider.GetComponent <BluegsPoint>();
         if (point)
         {
             direction *= -1.0f; sprite.flipX = direction.x > 0;
         }
     }
 }