MainMenueShop weiter angepasst, DevMode gebaut, Text funktioniert noch nicht, CreditsScene Panel fertig
This commit is contained in:
@@ -2,35 +2,58 @@ using System.Xml.Serialization;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.U2D;
|
||||
|
||||
public class ShopScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject shopPanel;
|
||||
[SerializeField] GameObject errorPanel;
|
||||
InventoryScript player;
|
||||
|
||||
private bool paymentSystemActive = false;
|
||||
[SerializeField] TMP_Text text;
|
||||
TMP_Text textfeld;
|
||||
//InventoryScript player;
|
||||
|
||||
//TMP_Text textfeld;
|
||||
[SerializeField] TMP_Text textfeld;
|
||||
InventoryScript inventory;
|
||||
|
||||
private float moneten = 1000; //als vorerstiger Ersatz für tatsächliches Geld
|
||||
|
||||
private int gemsCost = 100; //1€
|
||||
private int manyGemsCost = 200; //2€
|
||||
private int updateCost = 100;
|
||||
|
||||
#region DevMode
|
||||
|
||||
[SerializeField] GameObject devPanel;
|
||||
|
||||
//TMP_Text textfeldA; //als textfeld
|
||||
//TMP_Text textfeldB;
|
||||
//TMP_Text textfeldC;
|
||||
|
||||
[SerializeField] TMP_Text textfeldA; //als text
|
||||
[SerializeField] TMP_Text textfeldB;
|
||||
[SerializeField] TMP_Text textfeldC;
|
||||
|
||||
#endregion
|
||||
|
||||
void Start()
|
||||
{
|
||||
player = GetComponent<InventoryScript>();
|
||||
InventoryScript inventory = GetComponent<InventoryScript>();
|
||||
|
||||
shopPanel.SetActive(false);
|
||||
errorPanel.SetActive(false);
|
||||
devPanel.SetActive(false);
|
||||
|
||||
textfeld = this.text;
|
||||
//player = GetComponent<InventoryScript>();
|
||||
//textfeld = this.text;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
textfeld.text = InventoryScript.deineMudda.ToString();
|
||||
}
|
||||
|
||||
textfeld.text = inventory.Gems.ToString();
|
||||
|
||||
|
||||
ShowDevMode();
|
||||
}
|
||||
|
||||
public void OpenShop()
|
||||
{
|
||||
@@ -49,19 +72,24 @@ public class ShopScript : MonoBehaviour
|
||||
|
||||
public void AddLife()
|
||||
{
|
||||
player.Health++;
|
||||
inventory.Health++;
|
||||
|
||||
inventory.Gems -= updateCost;
|
||||
}
|
||||
|
||||
public void AddEnergy()
|
||||
{
|
||||
player.Energy++;
|
||||
inventory.Energy++;
|
||||
|
||||
inventory.Gems -= updateCost;
|
||||
}
|
||||
|
||||
public void BuyGems()
|
||||
{
|
||||
if (paymentSystemActive)
|
||||
{
|
||||
|
||||
moneten -= gemsCost;
|
||||
Debug.Log("Ich mag Moeneten");
|
||||
}
|
||||
|
||||
else
|
||||
@@ -73,11 +101,10 @@ public class ShopScript : MonoBehaviour
|
||||
public void BuyMore()
|
||||
{
|
||||
|
||||
int manyGemsCost = 200;
|
||||
|
||||
if (paymentSystemActive)
|
||||
{
|
||||
|
||||
moneten -= manyGemsCost;
|
||||
Debug.Log("Ich mag Moeneten");
|
||||
}
|
||||
|
||||
else
|
||||
@@ -85,4 +112,41 @@ public class ShopScript : MonoBehaviour
|
||||
errorPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowDevMode()
|
||||
{
|
||||
devPanel.SetActive(true);
|
||||
|
||||
//textfeldA = textA;
|
||||
//textfeldB = textB;
|
||||
//textfeldC = textC;
|
||||
|
||||
textfeldA.text = inventory.Energy.ToString();
|
||||
textfeldB.text = inventory.Health.ToString();
|
||||
textfeldC.text = moneten.ToString();
|
||||
}
|
||||
|
||||
public void ChangeActivation()
|
||||
{
|
||||
SpriteRenderer spriteRenderer = GetComponent<SpriteRenderer>();
|
||||
|
||||
if (paymentSystemActive)
|
||||
{
|
||||
paymentSystemActive = false;
|
||||
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("T_11_no.png");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
paymentSystemActive = true;
|
||||
spriteRenderer.sprite = Resources.Load<Sprite>("T_12_ok.png");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseDevPanel()
|
||||
{
|
||||
devPanel.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user