Пример #1
0
    private void OnCollisionEnter(Collision collision)
    {
        IDestructible otherDestructibleBehaviour = collision.gameObject.GetComponent <IDestructible>();
        IDestructible thisDestructibleBehaviour  = GetComponent <IDestructible>();

        if (otherDestructibleBehaviour != null)
        {
            otherDestructibleBehaviour.DestroySelf();
        }
        if (thisDestructibleBehaviour != null)
        {
            thisDestructibleBehaviour.DestroySelf();
        }
    }