Files
HauntedBloodlines/Assets/Scripts/Inventory/Items/PocketWatchPickable.cs
2025-05-29 22:31:40 +03:00

40 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PocketWatchPickable : MonoBehaviour
{
public void PickupPocketWatch()
{
var ringInventory = RingInventory.GetInstance();
var inventoryManager = InventoryManager.GetInstance();
var gameProgress = GameProgressManager.GetInstance();
if (ringInventory == null || inventoryManager == null || gameProgress == null)
{
Debug.LogError("PocketWatchPickable: One or more required instances are null!");
return;
}
if (inventoryManager.pocketWatchOnRingInventory == null)
{
Debug.LogError("PocketWatchPickable: pocketWatchOnRingInventory is null!");
return;
}
Debug.Log("Attempting to add pocket watch to inventory...");
ringInventory.AddItemToKeysAndItemsInventory(inventoryManager.pocketWatchOnRingInventory.transform);
Debug.Log("Activating pocketWatchOnRingInventory...");
inventoryManager.pocketWatchOnRingInventory.SetActive(true);
Debug.Log("Saving pocket watch data temporarily...");
inventoryManager.SaveTemporarilyPocketWatchInventoryItemData(true);
gameProgress.PocketWatchIsObtained = true;
Debug.Log("Disabling pocket watch game object...");
gameObject.SetActive(false);
}
}