StarsInfoText

This commit is contained in:
brausjonas
2023-02-27 18:06:21 +01:00
parent b00b428c9b
commit 14b4a280b0
19 changed files with 1290 additions and 84 deletions
@@ -37,6 +37,7 @@ public class NoPlayablePlayer : Player
{
GameObject.Find("StarPositions").GetComponent<StarController>().SwitchStar();
AddCoins(-20);
AddStars(1);
}
public void CoinFieldAction(int action)
@@ -50,7 +50,7 @@ public class PlayablePlayer : Player
if (activated && !name.Equals(""))
{
//Generiere Würfelzahl von 1-6 wenn gerade gewürfelt werden darf
if ((Input.GetMouseButtonDown(0)) && wurfelZahl == 0 && !wurfelt)
if ((Input.GetMouseButtonDown(0) && !uiHandler.MapOpen) && wurfelZahl == 0 && !wurfelt)
{
wurfelt = true;
wurfelZahl = Random.Range(1, 7);
@@ -233,6 +233,7 @@ public class PlayablePlayer : Player
{
currentStar.Buy(this);
client.SendBuyStar();
AddStars(1);
}
else
{
+8 -1
View File
@@ -16,7 +16,8 @@ public abstract class Player : MonoBehaviour
protected Vector3 cameraOffset = new Vector3(-2.81f, 8.13f, 5.6f);
public int index;
public int coins = 0;
public TMP_Text textCoinsInfo;
public int stars = 0;
public TMP_Text textCoinsInfo, textStarsInfo;
protected bool eventstop = false;
public UIHandler uiHandler;
@@ -53,6 +54,12 @@ public abstract class Player : MonoBehaviour
Coin
}
public void AddStars(int amount)
{
stars += amount;
textStarsInfo.text = stars + "";
}
public void AddCoins(int amount)
{
coins += amount;
@@ -6,4 +6,5 @@ using UnityEngine;
public class PlayerInfoElements : MonoBehaviour
{
public TMP_Text textCoinInfo;
public TMP_Text textStarsInfo;
}