public virtual void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.CompareTag(NameTagLayer.t_pig) || collision.collider.CompareTag(NameTagLayer.t_block)) { isHurt = true; if (hurtImage) { spriteRender.sprite = hurtImage; } collision.gameObject.GetComponent <EnemyUnit>().BirdCrash(rigi); birdTrail.ClearTrail(); } }
/// <summary> /// 碰撞检测 /// </summary> /// <param name="collision"></param> private void OnCollisionEnter2D(Collision2D collision) { isFly = false; birdTrail.ClearTrail(); // 关闭拖尾效果 }