Exemplo n.º 1
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.attachedRigidbody == null)
        {
            return;
        }

        PickableObject pickable = other.attachedRigidbody.GetComponent <PickableObject>();

        if (pickable != null)
        {
            if (pickable.GetVelocity().magnitude >= _forceToBreak)
            {
                Break(pickable.transform.position, pickable.GetVelocity());
            }
        }

        PlayerController player = other.attachedRigidbody.GetComponent <PlayerController>();

        if (player != null)
        {
            if (player.GetVelocity().magnitude >= _forceToBreak)
            {
                Break(player.transform.position, player.GetVelocity());
            }
        }
    }