StarSystem
Stars With switching positions (Bought stars are not saved or shown)
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject layout0;
|
||||
[SerializeField] private GameObject layout1;
|
||||
[SerializeField] private GameObject layout2;
|
||||
[SerializeField] private GameObject layoutMiniMap;
|
||||
[SerializeField] private GameObject layoutBuyStar;
|
||||
|
||||
@@ -17,6 +19,8 @@ public class UIHandler : MonoBehaviour
|
||||
layout0.SetActive(true);
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
public void ActivateLayout1()
|
||||
@@ -25,6 +29,7 @@ public class UIHandler : MonoBehaviour
|
||||
layout1.SetActive(true);
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutMiniMap()
|
||||
@@ -33,6 +38,7 @@ public class UIHandler : MonoBehaviour
|
||||
layout1.SetActive(false);
|
||||
layoutMiniMap.SetActive(true);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(false);
|
||||
}
|
||||
|
||||
public void ActivateLayoutBuyStar(Player player)
|
||||
@@ -42,5 +48,53 @@ public class UIHandler : MonoBehaviour
|
||||
layout1.SetActive(false);
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(true);
|
||||
layout2.SetActive(false);
|
||||
|
||||
LayoutBuyStarController controller = layoutBuyStar.GetComponent<LayoutBuyStarController>();
|
||||
|
||||
if (player.coins < 20)
|
||||
{
|
||||
controller.infoText.text = "oh... sorry... but you do not have enough coins (20)";
|
||||
controller.buttonBuy.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller.infoText.text = "do you want to buy a star? (20 coins)";
|
||||
controller.buttonBuy.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void ActivateLayout2(Player player)
|
||||
{
|
||||
currentPlayer = player;
|
||||
|
||||
layout0.SetActive(false);
|
||||
layout1.SetActive(false);
|
||||
layoutMiniMap.SetActive(false);
|
||||
layoutBuyStar.SetActive(false);
|
||||
layout2.SetActive(true);
|
||||
}
|
||||
|
||||
public void ButtonBuyStar()
|
||||
{
|
||||
((PlayablePlayer)currentPlayer).BuyStar(true);
|
||||
ActivateLayout1();
|
||||
}
|
||||
|
||||
public void ButtonDontBuyStar()
|
||||
{
|
||||
((PlayablePlayer)currentPlayer).BuyStar(false);
|
||||
ActivateLayout1();
|
||||
}
|
||||
|
||||
public void ButtonMoveOn()
|
||||
{
|
||||
ActivateLayout1();
|
||||
((PlayablePlayer)currentPlayer).SkipShop();
|
||||
}
|
||||
|
||||
public void ButtonEnter()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user