Beispiel #1
0
    private void OnTriggerEnter(Collider other)
    {
        IActivation activationObject = other.GetComponent <IActivation>();

        if (activationObject != null)
        {
            activationObject.DoActivate();
        }
    }
Beispiel #2
0
    private void OnCollisionEnter(Collision collision)
    {
        IBreakable breakable = collision.gameObject.GetComponent <IBreakable>();

        if (breakable != null)
        {
            breakable.BreakObject();
        }

        IActivation activationObject = collision.gameObject.GetComponent <IActivation>();

        if (activationObject != null)
        {
            activationObject.DoActivate();
        }
    }