MainMenue weiterbearbeitet und Shop angelegt
This commit is contained in:
74
Assets/Scripts/Button Functions/ShopScript.cs
Normal file
74
Assets/Scripts/Button Functions/ShopScript.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using System.Xml.Serialization;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class ShopScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject shopPanel;
|
||||
[SerializeField] GameObject errorPanel;
|
||||
public InventoryScript player;
|
||||
|
||||
private bool paymentSystemActive = true;
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
player = GetComponent<InventoryScript>();
|
||||
|
||||
shopPanel.SetActive(false);
|
||||
errorPanel.SetActive(false);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OpenShop()
|
||||
{
|
||||
shopPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void CloseShop()
|
||||
{
|
||||
shopPanel.SetActive(false);
|
||||
}
|
||||
|
||||
public void AddLife()
|
||||
{
|
||||
player.Health++;
|
||||
}
|
||||
|
||||
public void AddEnergy()
|
||||
{
|
||||
player.Energy++;
|
||||
}
|
||||
|
||||
public void BuyGems()
|
||||
{
|
||||
if (paymentSystemActive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
errorPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void BuyMore()
|
||||
{
|
||||
if (paymentSystemActive)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
errorPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Button Functions/ShopScript.cs.meta
Normal file
2
Assets/Scripts/Button Functions/ShopScript.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a63d792debb71643a4072a0cc116dbe
|
||||
8
Assets/Scripts/Player.meta
Normal file
8
Assets/Scripts/Player.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0398a6a4757598944bd41c97bd7361c0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/Scripts/Player/InventoryScript.cs
Normal file
34
Assets/Scripts/Player/InventoryScript.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class InventoryScript : MonoBehaviour
|
||||
{
|
||||
//Energy
|
||||
[SerializeField] int energy = 10;
|
||||
|
||||
public InventoryScript(int energy)
|
||||
{
|
||||
this.energy = energy;
|
||||
}
|
||||
|
||||
public int Energy { get => energy; set => energy = value; }
|
||||
|
||||
//Health
|
||||
[SerializeField] int health = 1;
|
||||
public int Health { get => health; set => health = value; }
|
||||
|
||||
//Gems
|
||||
[SerializeField] int gems;
|
||||
public int Gems { get => gems; set => gems = value; }
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Player/InventoryScript.cs.meta
Normal file
2
Assets/Scripts/Player/InventoryScript.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5973ed7f2e7a3374d97418dafd88e753
|
||||
Reference in New Issue
Block a user