void OnTriggerEnter2D(Collider2D other) { Pushable pushable = other.GetComponent <Pushable>(); if (pushable != null) { m_CurrentPushables.Add(pushable); } Climbable climbable = other.GetComponent <Climbable>(); if (climbable != null) { m_CurrentClimbable = climbable; } }
void OnTriggerExit2D(Collider2D other) { Pushable pushable = other.GetComponent <Pushable>(); if (pushable != null) { if (m_CurrentPushables.Contains(pushable)) { m_CurrentPushables.Remove(pushable); } } Climbable climbable = other.GetComponent <Climbable>(); if (climbable != null) { m_CurrentClimbable = null; } }