Exemple #1
0
    /// <summary>
    /// If this object collides with a Virus object, it will disable the virus object (consume it) by calling its Die()
    /// method
    /// </summary>
    /// <param name="collision"></param>
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Virus virusComponent = collision.gameObject.GetComponent <Virus>();

        if (virusComponent != null)
        {
            virusComponent.Die();
        }
    }