예제 #1
0
    public virtual void OnCollisionEnter2D(Collision2D collision)
    {
        IDeletable deletable = collision.gameObject.GetComponent(typeof(IDeletable)) as IDeletable;

        if (deletable != null)
        {
            bool deleted = deletable.Delete(parent);
            if (deleted)
            {
                parent.Despawn();
            }
        }
        else
        {
            parent.Despawn();
        }
    }