private void UseLock()
    {
        interacting = true;

        // Close it
        if (lockInRange.isOpen)
        {
            if (inventory.CheckInventoryFull())
            {
                Debug.Log("Max inventory is 3");
                return;
            }

            GameObject objectToAdd = lockInRange.Close();

            inventory.AddItem(objectToAdd);
        }
        else
        {
            int tryKey = -1;

            tryKey = lockInRange.Open(inventory.GetItemIds());
            // no valid key is possessed
            if (tryKey < 0)
            {
                return;
            }

            inventory.UseItem(tryKey, lockInRange);
        }
    }
Example #2
0
    static void OpenLockObject()
    {
        if (instance != null)
        {
            instance.Close();
        }

        instance = EditorWindow.CreateInstance <LockObject>();
        instance.Show();
    }
Example #3
0
 private void ReturnLockObject(LockObject lockObject)
 {
     lock (_lockTable)
     {
         if (lockObject.Close())
         {
             _lockTable.Remove(lockObject.GetKey());
         }
     }
 }