31 lines
844 B
C#
31 lines
844 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class ItemShopButtons : MonoBehaviour
|
|
{
|
|
public Button buyButton; // Der Button im Shop
|
|
public GameObject player; // Dein Spieler-Objekt
|
|
public MonoBehaviour weaponScript; // Das Skript für die Waffe
|
|
|
|
private bool isUnlocked = false;
|
|
|
|
void Start()
|
|
{
|
|
buyButton.onClick.AddListener(UnlockWeapon);
|
|
weaponScript.enabled = false; // Waffe ist am Anfang deaktiviert
|
|
}
|
|
|
|
void UnlockWeapon()
|
|
{
|
|
if (!isUnlocked)
|
|
{
|
|
isUnlocked = true;
|
|
weaponScript.enabled = true; // Aktiviere das Waffenskript
|
|
buyButton.interactable = false; // Deaktiviere den Button nach dem Kauf
|
|
Debug.Log("Waffe wurde freigeschaltet!");
|
|
}
|
|
}
|
|
}
|