private void OnTriggerExit2D(Collider2D other) // makes sure the ladder caanot be used outside of box collider { if (other.tag == "Useable") { useable = null; } }
public override void OnTriggerEnter2D(Collider2D other) //allows ladder use when colliding with ladder { if (other.tag == "Useable") { useable = other.GetComponent <Iuseable>(); } base.OnTriggerEnter2D(other); }
public void UseItem() { if (m_inventory.GetItem(m_equipedItem) != null && m_inventory.GetItem(m_equipedItem).m_isUsable) { Iuseable useable = m_inventory.GetItem(m_equipedItem).m_item.GetComponent <Iuseable>(); if (useable != null) { //TODO should probably be handled in a seperate class Iuseable.status status = useable.Use(gameObject, m_orientation); m_animator.useItem(m_inventory.GetItem(m_equipedItem).m_itemId); handleItemStatus(status); } } }