/// <summary> /// Called when [trigger enter]. /// </summary> /// <param name="other">The other.</param> private void OnTriggerEnter(Collider other) { if (other.tag == "Ball") { print("got ball! "); PowerUpThrow put = other.GetComponentInParent <PowerUpThrow>(); put.ShieldTouch(); } }
/// <summary> /// Called when [collision enter]. /// </summary> /// <param name="other">The other.</param> private void OnCollisionEnter(Collision other) { print(other.transform.tag); if (other.transform.tag == "Shield") { print("got shield! " + other.relativeVelocity.magnitude); PowerUpThrow put = GetComponent <PowerUpThrow>(); put.ShieldTouch(); } if (other.transform.tag == "Ball") { PowerUpThrow putt = null; putt = other.gameObject.GetComponent <PowerUpThrow>(); print(putt); print(other.relativeVelocity.magnitude); print(other); print(transform); putt.ShieldTouch(other.relativeVelocity.magnitude, other, transform); } }