UI's added, shop and basic currency are done, BUGS: can move around the map when scrolling shop, object do not get selected
This commit is contained in:
File diff suppressed because it is too large
Load Diff
18
Assets/Game/Scripts/GemsManager.cs
Normal file
18
Assets/Game/Scripts/GemsManager.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GemsManager : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Game/Scripts/GemsManager.cs.meta
Normal file
11
Assets/Game/Scripts/GemsManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b195fdb5ea64a0749995a2bb337f6557
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
39
Assets/Game/Scripts/GetPrice.cs
Normal file
39
Assets/Game/Scripts/GetPrice.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class GetPrice : MonoBehaviour
|
||||
{
|
||||
public TMP_Text mytext;
|
||||
public TMP_Text gemsText;
|
||||
private float gemsAmount;
|
||||
private float updatedPrice = 0f;
|
||||
private float price = 0f;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
updatedPrice = gemsAmount - price;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void getPrice()
|
||||
{
|
||||
if(updatedPrice >= price){
|
||||
price = float.Parse(mytext.text);
|
||||
gemsAmount = float.Parse(gemsText.text);
|
||||
|
||||
updatedPrice = gemsAmount - price;
|
||||
gemsText.text = updatedPrice.ToString();
|
||||
}
|
||||
else Debug.Log("Not enough gems");
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Game/Scripts/GetPrice.cs.meta
Normal file
11
Assets/Game/Scripts/GetPrice.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44e7ddb03d9043a4aae9f274b6cae07f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/Game/Scripts/ShopScript.cs
Normal file
34
Assets/Game/Scripts/ShopScript.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class ShopScript : MonoBehaviour
|
||||
{
|
||||
public GameObject shopUI;
|
||||
public GameObject GemsMenu;
|
||||
public string shopButtonName;
|
||||
|
||||
|
||||
public void openShop()
|
||||
{
|
||||
shopButtonName = EventSystem.current.currentSelectedGameObject.name;
|
||||
checkButton();
|
||||
|
||||
}
|
||||
|
||||
public void checkButton()
|
||||
{
|
||||
switch (shopButtonName)
|
||||
{
|
||||
case "Button_Shop": shopUI.SetActive(true); break;
|
||||
case "Coin": shopUI.SetActive(true); GemsMenu.SetActive(false); break;
|
||||
case "Gem": GemsMenu.SetActive(true); shopUI.SetActive(false); break;
|
||||
}
|
||||
}
|
||||
public void closeShop()
|
||||
{
|
||||
shopUI.SetActive(false);
|
||||
GemsMenu.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/Game/Scripts/ShopScript.cs.meta
Normal file
11
Assets/Game/Scripts/ShopScript.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca72ca0211b2f0a42bc9487337e10f10
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user