MainMenueShop weiter angepasst, DevMode gebaut, Text funktioniert noch nicht, CreditsScene Panel fertig
This commit is contained in:
@@ -615,7 +615,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.392}
|
||||
m_Color: {r: 0.59607846, g: 0, b: 0, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
@@ -808,8 +808,8 @@ MonoBehaviour:
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
rgba: 4278190335
|
||||
m_fontColor: {r: 1, g: 0, b: 0, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
@@ -1038,6 +1038,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::CreditsScript
|
||||
scrollSpeed: 0
|
||||
maxYPosition: 0
|
||||
minYPosition: 0
|
||||
text: {fileID: 1259493872}
|
||||
--- !u!114 &1259493872
|
||||
MonoBehaviour:
|
||||
@@ -1068,8 +1069,8 @@ MonoBehaviour:
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
rgba: 4286485733
|
||||
m_fontColor: {r: 0.8962264, g: 0.5807945, b: 0.49461553, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,34 +2,32 @@ using UnityEngine;
|
||||
|
||||
public class InventoryScript : MonoBehaviour
|
||||
{
|
||||
|
||||
public static int deineMudda = 2;
|
||||
static int deinVadda = 0;
|
||||
|
||||
//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
|
||||
|
||||
|
||||
public InventoryScript(int energy, int health, int gems)
|
||||
{
|
||||
this.energy = energy;
|
||||
this.health = health;
|
||||
this.gems = gems;
|
||||
}
|
||||
|
||||
public int Energy { get => energy; set => energy = value; }
|
||||
public int Health { get => health; set => health = value; }
|
||||
public int Gems { get => gems; set => gems = value; }
|
||||
|
||||
void Start()
|
||||
{
|
||||
Gems = 10;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
serializedVersion: 3
|
||||
tags:
|
||||
- Button
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
@@ -50,27 +51,3 @@ TagManager:
|
||||
- Light Layer 5
|
||||
- Light Layer 6
|
||||
- Light Layer 7
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user