/// <summary> /// Unity 2D trigger hook /// </summary> /// <param name="other">Other.</param> void OnTriggerExit2D(Collider2D other) { if (!string.IsNullOrEmpty(otherColliderTag) && other.tag != otherColliderTag) { return; } Character character = null; CharacterReference characterReference = other.GetComponent <CharacterReference> (); if (characterReference != null) { character = characterReference.Character; } if (character == null) { character = other.GetComponentInParent <Character> (); } if (character != null) { LeaveTrigger(character); } else if (other.GetComponent <Rigidbody2D>() != null) { LeaveTrigger(null); } }
/// <summary> /// Unity 2D trigger hook /// </summary> /// <param name="other">Other.</param> void OnTriggerExit2D(Collider2D other) { Character character = null; CharacterReference characterReference = other.GetComponent <CharacterReference> (); if (characterReference != null) { character = characterReference.Character; } if (character == null) { character = other.GetComponentInParent <Character> (); } LeaveTrigger(character); }
/// <summary> /// Unity 2D trigger hook /// </summary> /// <param name="other">Other.</param> void OnTriggerExit2D(Collider2D other) { Character character = null; CharacterReference characterReference = other.GetComponent <CharacterReference> (); if (characterReference != null) { character = characterReference.Character; } if (character == null) { character = other.GetComponentInParent <Character> (); } if (character != null) { LeaveTrigger(character); } else if (other.GetComponent <Rigidbody2D>() != null) { LeaveTrigger(null); } }
/// <summary> /// Unity 2D trigger hook /// </summary> /// <param name="other">Other.</param> void OnTriggerEnter2D(Collider2D other) { Character character = null; CharacterReference characterReference = other.GetComponent <CharacterReference> (); if (characterReference != null) { character = characterReference.Character; } if (character == null) { character = other.GetComponentInParent <Character> (); } if (character != null) { Debug.Log("Enter Trigger :: " + other.name); EnterTrigger(character); } else if (other.GetComponent <Rigidbody2D>() != null) { EnterTrigger(null); } }