Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using AC;
- using System.Collections.Generic;
- public class CheckCards : MonoBehaviour
- {
- public ActionList playerWinsCutscene;
- public ActionList setCutscene;
- private int cardNumber;
- private int tempVariable;
- private InvItem selectedItem;
- public void CheckCard()
- {
- // Step 1: Check selected inventory item
- selectedItem = AC.KickStarter.runtimeInventory.SelectedItem;
- List<string> itemsToRemove = new List<string>(); // Temporary list to hold items to remove
- if (selectedItem != null)
- {
- for (int i = 1; i <= 10; i++)
- {
- if (selectedItem.label == "KCards/Card" + i)
- {
- cardNumber = i;
- break;
- }
- }
- }
- // Step 2: Check local variable and perform actions
- GVar variable = AC.LocalVariables.GetVariable("Card" + cardNumber);
- if (cardNumber > 0 && AC.LocalVariables.GetIntegerValue(variable.id) > 2)
- {
- // Add "KCards/CardNumber" to the list of items to remove
- itemsToRemove.Add("KCards/Card" + cardNumber);
- Debug.Log("Card is Card " + selectedItem.label);
- }
- // Remove items after iterating through the collection
- foreach (string itemLabel in itemsToRemove)
- {
- KickStarter.runtimeInventory.Remove(itemLabel, 3);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement