예제 #1
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        WallMagnet magnet = collision.GetComponent <WallMagnet>();

        if (magnet != null && magnets.Contains(magnet))
        {
            magnets.Remove(magnet);
        }
    }
예제 #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        WallMagnet magnet = collision.GetComponent <WallMagnet>();

        if (magnet != null)
        {
            magnets.Add(magnet);
        }
    }