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_Name:
|
||||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||||
m_Material: {fileID: 0}
|
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_RaycastTarget: 1
|
||||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||||
m_Maskable: 1
|
m_Maskable: 1
|
||||||
@@ -808,8 +808,8 @@ MonoBehaviour:
|
|||||||
m_fontMaterials: []
|
m_fontMaterials: []
|
||||||
m_fontColor32:
|
m_fontColor32:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
rgba: 4294967295
|
rgba: 4278190335
|
||||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
m_fontColor: {r: 1, g: 0, b: 0, a: 1}
|
||||||
m_enableVertexGradient: 0
|
m_enableVertexGradient: 0
|
||||||
m_colorMode: 3
|
m_colorMode: 3
|
||||||
m_fontColorGradient:
|
m_fontColorGradient:
|
||||||
@@ -1038,6 +1038,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier: Assembly-CSharp::CreditsScript
|
m_EditorClassIdentifier: Assembly-CSharp::CreditsScript
|
||||||
scrollSpeed: 0
|
scrollSpeed: 0
|
||||||
maxYPosition: 0
|
maxYPosition: 0
|
||||||
|
minYPosition: 0
|
||||||
text: {fileID: 1259493872}
|
text: {fileID: 1259493872}
|
||||||
--- !u!114 &1259493872
|
--- !u!114 &1259493872
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@@ -1068,8 +1069,8 @@ MonoBehaviour:
|
|||||||
m_fontMaterials: []
|
m_fontMaterials: []
|
||||||
m_fontColor32:
|
m_fontColor32:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
rgba: 4294967295
|
rgba: 4286485733
|
||||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
m_fontColor: {r: 0.8962264, g: 0.5807945, b: 0.49461553, a: 1}
|
||||||
m_enableVertexGradient: 0
|
m_enableVertexGradient: 0
|
||||||
m_colorMode: 3
|
m_colorMode: 3
|
||||||
m_fontColorGradient:
|
m_fontColorGradient:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,35 +2,58 @@ using System.Xml.Serialization;
|
|||||||
using TMPro;
|
using TMPro;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.U2D;
|
||||||
|
|
||||||
public class ShopScript : MonoBehaviour
|
public class ShopScript : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] GameObject shopPanel;
|
[SerializeField] GameObject shopPanel;
|
||||||
[SerializeField] GameObject errorPanel;
|
[SerializeField] GameObject errorPanel;
|
||||||
InventoryScript player;
|
|
||||||
|
|
||||||
private bool paymentSystemActive = false;
|
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()
|
void Start()
|
||||||
{
|
{
|
||||||
player = GetComponent<InventoryScript>();
|
InventoryScript inventory = GetComponent<InventoryScript>();
|
||||||
|
|
||||||
shopPanel.SetActive(false);
|
shopPanel.SetActive(false);
|
||||||
errorPanel.SetActive(false);
|
errorPanel.SetActive(false);
|
||||||
|
devPanel.SetActive(false);
|
||||||
|
|
||||||
textfeld = this.text;
|
//textfeld = this.text;
|
||||||
//player = GetComponent<InventoryScript>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
textfeld.text = InventoryScript.deineMudda.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
textfeld.text = inventory.Gems.ToString();
|
||||||
|
|
||||||
|
|
||||||
|
ShowDevMode();
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenShop()
|
public void OpenShop()
|
||||||
{
|
{
|
||||||
@@ -49,19 +72,24 @@ public class ShopScript : MonoBehaviour
|
|||||||
|
|
||||||
public void AddLife()
|
public void AddLife()
|
||||||
{
|
{
|
||||||
player.Health++;
|
inventory.Health++;
|
||||||
|
|
||||||
|
inventory.Gems -= updateCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddEnergy()
|
public void AddEnergy()
|
||||||
{
|
{
|
||||||
player.Energy++;
|
inventory.Energy++;
|
||||||
|
|
||||||
|
inventory.Gems -= updateCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BuyGems()
|
public void BuyGems()
|
||||||
{
|
{
|
||||||
if (paymentSystemActive)
|
if (paymentSystemActive)
|
||||||
{
|
{
|
||||||
|
moneten -= gemsCost;
|
||||||
|
Debug.Log("Ich mag Moeneten");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -73,11 +101,10 @@ public class ShopScript : MonoBehaviour
|
|||||||
public void BuyMore()
|
public void BuyMore()
|
||||||
{
|
{
|
||||||
|
|
||||||
int manyGemsCost = 200;
|
|
||||||
|
|
||||||
if (paymentSystemActive)
|
if (paymentSystemActive)
|
||||||
{
|
{
|
||||||
|
moneten -= manyGemsCost;
|
||||||
|
Debug.Log("Ich mag Moeneten");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -85,4 +112,41 @@ public class ShopScript : MonoBehaviour
|
|||||||
errorPanel.SetActive(true);
|
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 class InventoryScript : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
public static int deineMudda = 2;
|
|
||||||
static int deinVadda = 0;
|
|
||||||
|
|
||||||
//Energy
|
//Energy
|
||||||
[SerializeField] int energy = 10;
|
[SerializeField] int energy = 10;
|
||||||
public InventoryScript(int energy)
|
|
||||||
{
|
|
||||||
this.energy = energy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Energy { get => energy; set => energy = value; }
|
|
||||||
|
|
||||||
//Health
|
//Health
|
||||||
[SerializeField] int health = 1;
|
[SerializeField] int health = 1;
|
||||||
public int Health { get => health; set => health = value; }
|
|
||||||
|
|
||||||
//Gems
|
//Gems
|
||||||
[SerializeField] int gems;
|
[SerializeField] int gems;
|
||||||
|
|
||||||
|
|
||||||
|
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; }
|
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()
|
void Start()
|
||||||
{
|
{
|
||||||
Gems = 10;
|
Gems = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
--- !u!78 &1
|
--- !u!78 &1
|
||||||
TagManager:
|
TagManager:
|
||||||
serializedVersion: 2
|
serializedVersion: 3
|
||||||
tags: []
|
tags:
|
||||||
|
- Button
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
@@ -50,27 +51,3 @@ TagManager:
|
|||||||
- Light Layer 5
|
- Light Layer 5
|
||||||
- Light Layer 6
|
- Light Layer 6
|
||||||
- Light Layer 7
|
- Light Layer 7
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
-
|
|
||||||
|
|||||||
Reference in New Issue
Block a user