示例#1
0
 private void OnTriggerExit2D(Collider2D other)      // makes sure the ladder caanot be used outside of box collider
 {
     if (other.tag == "Useable")
     {
         useable = null;
     }
 }
示例#2
0
 public override void OnTriggerEnter2D(Collider2D other)     //allows ladder use when colliding with ladder
 {
     if (other.tag == "Useable")
     {
         useable = other.GetComponent <Iuseable>();
     }
     base.OnTriggerEnter2D(other);
 }
示例#3
0
 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);
         }
     }
 }