62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System;
|
|
|
|
public class KeysManager : MonoBehaviour
|
|
{
|
|
public List<string> keyNameID;
|
|
public string currentlySelectedInventoryKeyNameID;
|
|
public bool currentlySelectedKeyAndDoorNameMatch;
|
|
public bool currentlySelectedJointAndJointHoleMatch;
|
|
//public string currentlySelectedKeyType;
|
|
public GameObject currentlySelectedKeyGo;
|
|
public GameObject currentlySelectedKeyModelForKeyHole;
|
|
public List<string> keysToRemoveFromSavedData;
|
|
|
|
private static KeysManager _instance;
|
|
public static KeysManager GetInstance() { return _instance; }
|
|
|
|
public enum CurrentlySelectedKeyType
|
|
{
|
|
None,
|
|
DoorKeyType,
|
|
BodyPartKeyType
|
|
}
|
|
|
|
public CurrentlySelectedKeyType currentlySelectedKeyType = CurrentlySelectedKeyType.None;
|
|
|
|
public void ChangeCurrentlySelectedKeyType(string keyType)
|
|
{
|
|
currentlySelectedKeyType = (CurrentlySelectedKeyType)Enum.Parse(typeof(CurrentlySelectedKeyType), keyType);
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (!_instance)
|
|
{
|
|
_instance = this;
|
|
}
|
|
}
|
|
|
|
public void AddKeyNameID(string NewKeyNameID)
|
|
{
|
|
keyNameID.Add(NewKeyNameID);
|
|
}
|
|
|
|
// Function to remove an item from the list based on its name
|
|
public void RemoveKeyNameIDFromList(string itemName)
|
|
{
|
|
if (keyNameID.Contains(itemName))
|
|
{
|
|
keysToRemoveFromSavedData.Add(itemName);
|
|
keyNameID.Remove(itemName);
|
|
Debug.Log(itemName + " removed from the list.");
|
|
}
|
|
else
|
|
{
|
|
Debug.LogWarning(itemName + " not found in the list.");
|
|
}
|
|
}
|
|
}
|