coin db working
This commit is contained in:
@@ -7,16 +7,20 @@ using System.Text;
|
||||
|
||||
public class CoinCounter : MonoBehaviour
|
||||
{
|
||||
public ulong coin = ulong.MaxValue; //szedje le db-bol a playerhez a coint
|
||||
public ulong coin; //szedje le db-bol a playerhez a coint
|
||||
public TMP_Text coinCounterUI;
|
||||
private string path;
|
||||
private StreamWriter writer;
|
||||
private StreamReader reader;
|
||||
|
||||
private DatabaseData db;
|
||||
private UsernameHandler usernameHandler;
|
||||
|
||||
private void Awake() {
|
||||
db = FindObjectOfType<DatabaseData>();
|
||||
usernameHandler = FindObjectOfType<UsernameHandler>();
|
||||
|
||||
|
||||
/*path = Application.persistentDataPath + "/coins.txt";
|
||||
|
||||
if(!File.Exists(path)){ //ha nincs meg ilyen fajl hozza letre
|
||||
@@ -37,6 +41,10 @@ public class CoinCounter : MonoBehaviour
|
||||
coinCounterUI.text = "Coins: " + coin.ToString();*/
|
||||
}
|
||||
|
||||
public void SetCoin(ulong number){
|
||||
coin = number;
|
||||
coinCounterUI.text = "Coins: " + coin.ToString();
|
||||
}
|
||||
|
||||
public void AddCoin(ulong number){
|
||||
coin += number;
|
||||
@@ -49,7 +57,7 @@ public class CoinCounter : MonoBehaviour
|
||||
|
||||
public void RemoveCoin(ulong number){
|
||||
coin -= number;
|
||||
//coinCounterUI.text = "Coins: " + coin.ToString();
|
||||
coinCounterUI.text = "Coins: " + coin.ToString();
|
||||
|
||||
/*writer = new StreamWriter(path, false, Encoding.Default);
|
||||
writer.Write(coin);
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public enum Colors {
|
||||
None = -1,
|
||||
Grey,
|
||||
Red,
|
||||
Blue,
|
||||
Green,
|
||||
Yellow,
|
||||
Rainbow
|
||||
};
|
||||
|
||||
public class ColorManager : MonoBehaviour
|
||||
{
|
||||
public Material[] colorMaterials = new Material[Enum.GetNames(typeof(Colors)).Length];
|
||||
|
||||
public void WashColor(GameObject washed) {
|
||||
SetColor(Colors.Grey, washed);
|
||||
}
|
||||
|
||||
public void SetColor(Colors color, GameObject toPaint, Collision collision = null) {
|
||||
if(color == Colors.None) {
|
||||
if (collision.transform.CompareTag("ColorChanger")) {
|
||||
toPaint.GetComponent<Renderer>().material.color = collision.transform.GetComponent<Renderer>().material.color;
|
||||
}
|
||||
} else {
|
||||
toPaint.GetComponent<Renderer>().material.color = colorMaterials[(int)color].color;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void CheckGroundColor(GameObject collided) {
|
||||
if (transform.GetComponent<Renderer>().material.color != collided.transform.GetComponent<Renderer>().material.color) {
|
||||
Debug.Log("The colors are not the same! GroundColor: " + collided.transform.GetComponent<Renderer>().material.color + " PlayerColor: "
|
||||
+ transform.GetComponent<Renderer>().material.color);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision collision) {
|
||||
if (collision.collider.CompareTag("Water")) {
|
||||
WashColor(collision.gameObject);
|
||||
} else if (collision.collider.CompareTag("Ground")) {
|
||||
CheckGroundColor(collision.gameObject);
|
||||
} else if (collision.collider.CompareTag("ColorChanger")) {
|
||||
SetColor(Colors.None, transform.gameObject, collision);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public class GroundController : MonoBehaviour
|
||||
|
||||
//Loading modules
|
||||
loadFrom = LoadPrefabs("Prefabs/Modulok");
|
||||
sideObjects = LoadPrefabs("Prefabs/World Objects/World 1");
|
||||
sideObjects = LoadPrefabs("Prefabs/WorldObjects/World1/");
|
||||
Debug.Log("loadFrom length: " + loadFrom.Length);
|
||||
Debug.Log("sideObjects Length: " + sideObjects.Length);
|
||||
|
||||
@@ -35,16 +35,27 @@ public class GroundController : MonoBehaviour
|
||||
|
||||
private void Update() {
|
||||
ground = GameObject.FindGameObjectsWithTag("Ground"); //torles miatt ujra le kell kerni a ground objecteket
|
||||
OrderGroundArrayByZ(); //rendezzuk z szerint hogy sorba legyenek
|
||||
sideObjectsSpawned = GameObject.FindGameObjectsWithTag("SideObject");
|
||||
|
||||
OrderArrayByZ(ground); //rendezzuk z szerint a talajt
|
||||
OrderArrayByZ(sideObjectsSpawned);
|
||||
|
||||
if(sideObjectsSpawned.Length > 0){
|
||||
lastSideObjectPos = sideObjectsSpawned[sideObjectsSpawned.Length-1].transform.position;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ground.Length; i++){ //ground objecteket mozgatja
|
||||
ground[i].transform.position = ground[i].transform.position + new Vector3(0,0, -groundMoveSpeed * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < sideObjectsSpawned.Length; i++){
|
||||
sideObjectsSpawned[i].transform.position = sideObjectsSpawned[i].transform.position + new Vector3(0,0, -groundMoveSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
//uj ground letrehozas
|
||||
if(ground[ground.Length-1].transform.position.z <= 120){
|
||||
CreateNewGround();
|
||||
CreateNewSideObjects();
|
||||
CreateNewSideObjects(false);
|
||||
|
||||
ground = GameObject.FindGameObjectsWithTag("Ground");
|
||||
|
||||
@@ -82,10 +93,21 @@ public class GroundController : MonoBehaviour
|
||||
return arr;
|
||||
}
|
||||
|
||||
private void CreateNewSideObjects(){
|
||||
private void CreateNewSideObjects(bool isLeftSide){
|
||||
int random = UnityEngine.Random.Range(0, sideObjects.Length);
|
||||
|
||||
Instantiate(sideObjects[random], lastSideObjectPos + new Vector3(0,0,20), ground[0].transform.rotation);
|
||||
GameObject inst = sideObjects[random];
|
||||
Vector3 pos = new Vector3(0,0,0);
|
||||
|
||||
if(inst.name == "haz1" && !isLeftSide){
|
||||
pos = new Vector3(4,0,0); //check pos in editor TODO!!
|
||||
}else if(inst.name == "haz2"){
|
||||
pos = new Vector3(9,0,0);
|
||||
}
|
||||
|
||||
if(isLeftSide) pos.x = -pos.x;
|
||||
|
||||
Instantiate(inst, lastSideObjectPos + pos, ground[0].transform.rotation);
|
||||
}
|
||||
|
||||
public void changeMaterialIndex(){
|
||||
@@ -102,14 +124,14 @@ public class GroundController : MonoBehaviour
|
||||
return false; //nem torolheto
|
||||
}
|
||||
|
||||
private void OrderGroundArrayByZ(){
|
||||
private void OrderArrayByZ(GameObject[] array){
|
||||
GameObject csere;
|
||||
for (int i = 0; i < ground.Length; i++){
|
||||
for (int i = 0; i < array.Length; i++){
|
||||
for(int j = 0; j < i; j++){
|
||||
if(ground[j].transform.position.z > ground[j+1].transform.position.z){
|
||||
csere = ground[j];
|
||||
ground[j] = ground[j+1];
|
||||
ground[j+1] = csere;
|
||||
if(array[j].transform.position.z > array[j+1].transform.position.z){
|
||||
csere = array[j];
|
||||
array[j] = array[j+1];
|
||||
array[j+1] = csere;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
Assets/Scripts/IsGrounded.cs
Normal file
13
Assets/Scripts/IsGrounded.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class IsGrounded : MonoBehaviour
|
||||
{
|
||||
public bool isGrounded = true;
|
||||
|
||||
private void OnCollisionEnter(Collision other) {
|
||||
//Debug.Log("pc <color=blue>"+other.gameObject.name+"</color>");
|
||||
isGrounded = true;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab4fe611c9713254e9fcc6e0de77f87f
|
||||
guid: 434812251bf6e1f44a54fa63754df2af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -21,12 +21,27 @@ public class DatabaseData : MonoBehaviour
|
||||
|
||||
public ulong coins = 0;
|
||||
|
||||
private string url;
|
||||
private bool forceLocalUrl = true;
|
||||
private const int PORT = 24002;
|
||||
|
||||
private void Awake() {
|
||||
hst = FindObjectOfType<HighScoreTable>(); //High Score Table referencia
|
||||
htdc = new HighScoreTableDataContainer(); //High Score Table Container objektum
|
||||
|
||||
coinc = FindObjectOfType<CoinCounter>();
|
||||
//writer = new StreamWriter(Application.persistentDataPath + "/coins.txt", false, Encoding.Default);
|
||||
|
||||
if((Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.OSXEditor) && forceLocalUrl){
|
||||
//ha az editorba van
|
||||
url = "http://localhost:" + PORT.ToString();
|
||||
}else if(!forceLocalUrl){
|
||||
url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
|
||||
}else{
|
||||
url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
|
||||
}
|
||||
|
||||
//url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
@@ -44,6 +59,7 @@ public class DatabaseData : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ParserCoin(string jsondata){
|
||||
//Debug.Log("<color=orange>JsonDataCoin:" + jsondata + "</color>");
|
||||
string data = "";
|
||||
for (int i = 0; i < jsondata.Length; i++)
|
||||
{
|
||||
@@ -51,8 +67,10 @@ public class DatabaseData : MonoBehaviour
|
||||
data += jsondata[i]; //kiszedi a szamokat a stringbol
|
||||
}
|
||||
}
|
||||
Debug.Log(data);
|
||||
Debug.Log("data coin: " + data);
|
||||
coins = ulong.Parse(data);
|
||||
Debug.Log("<color=orange>db coins: " + coins + "</color>");
|
||||
coinc.SetCoin(coins);
|
||||
}
|
||||
|
||||
//fuggvenyek amik meghivjak a rutint
|
||||
@@ -62,14 +80,19 @@ public class DatabaseData : MonoBehaviour
|
||||
public void PostNewScoreData(int playerid, ulong score, string time) => StartCoroutine(IPostNewScoreData(playerid, score, time));
|
||||
public void PostNewPalyaData() => StartCoroutine(IPostNewPalyaData());
|
||||
|
||||
public void GetCoinDataCall(int userid) => StartCoroutine(GetCoinData(userid));
|
||||
public void PostNewCoinData(ulong coins, int userid) => StartCoroutine(IPostNewCoinData(coins, userid));
|
||||
|
||||
public ulong GetCoins(int userid){
|
||||
StartCoroutine(GetCoinData(userid));
|
||||
|
||||
Debug.Log("<color=orange> Return coin: " + coins + "</color>");
|
||||
|
||||
return coins;
|
||||
}
|
||||
|
||||
private IEnumerator GetCoinData(int userid){
|
||||
string uri = "http://localhost:3000/coinget";
|
||||
string uri = url + "/coinget";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "GET");
|
||||
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+userid+"}");
|
||||
@@ -92,7 +115,7 @@ public class DatabaseData : MonoBehaviour
|
||||
private IEnumerator IGetPlayerData() {
|
||||
//input.text = "Loading..."; //ideiglenes szoveg amig nem jelenik meg az adat szoveg
|
||||
|
||||
string uri = "http://localhost:3000/player"; //backend vegpont linkje
|
||||
string uri = url + "/player"; //backend vegpont linkje
|
||||
|
||||
using (UnityWebRequest request = UnityWebRequest.Get(uri)) { //uj webrequest objektum letrehozasa, aminek megadjuk hogy ez egy get-es lekerdezes
|
||||
yield return request.SendWebRequest(); //amig be nem fejezodik az fv ide fog visszaterni
|
||||
@@ -120,7 +143,7 @@ public class DatabaseData : MonoBehaviour
|
||||
|
||||
|
||||
private IEnumerator IGetCurretPlayer(int userid){
|
||||
string uri = "http://localhost:3000/currentplayer";
|
||||
string uri = url + "/currentplayer";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "POST");
|
||||
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+userid+"}"); //palya id megadasa
|
||||
@@ -144,7 +167,7 @@ public class DatabaseData : MonoBehaviour
|
||||
}
|
||||
|
||||
private IEnumerator IGetHighScoreData(){
|
||||
string uri = "http://localhost:3000/toplist";
|
||||
string uri = url + "/toplist";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "GET");
|
||||
//byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+palya_id+"}"); //palya id megadasa
|
||||
@@ -167,7 +190,7 @@ public class DatabaseData : MonoBehaviour
|
||||
|
||||
|
||||
private IEnumerator IGetHighScoreDataNew(){
|
||||
string uri = "http://localhost:3000/toplist";
|
||||
string uri = url + "/toplist";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "GET");
|
||||
uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
|
||||
@@ -188,7 +211,7 @@ public class DatabaseData : MonoBehaviour
|
||||
|
||||
|
||||
private IEnumerator IGetPlayerCoins(string username){
|
||||
string uri = "http://localhost:3000/coinget";
|
||||
string uri = url + "/coinget";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "POST");
|
||||
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+username+"}"); //palya id megadasa
|
||||
@@ -211,7 +234,7 @@ public class DatabaseData : MonoBehaviour
|
||||
private IEnumerator IPostNewPlayerData() {
|
||||
//input.text = "loading...";
|
||||
|
||||
string uri = "http://localhost:3000/newplayer";
|
||||
string uri = url + "/newplayer";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "POST"); //post beallitasa
|
||||
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{ \"bevitel1\":\"postusername\"}"); //felviteli json
|
||||
@@ -232,7 +255,7 @@ public class DatabaseData : MonoBehaviour
|
||||
private IEnumerator IPostNewScoreData(int playerid, ulong score, string time) {
|
||||
//input.text = "loading...";
|
||||
|
||||
string uri = "http://localhost:3000/newscore";
|
||||
string uri = url + "/newscore";
|
||||
|
||||
//felhasznalonevet ki kell irni fajlba
|
||||
//ha username keresve lenne es ha nincs akkor kap egy uj id-t ami ideiglenesen tarolodik (ures string a visszateres?)
|
||||
@@ -261,7 +284,7 @@ public class DatabaseData : MonoBehaviour
|
||||
private IEnumerator IPostNewPalyaData() {
|
||||
//input.text = "loading...";
|
||||
|
||||
string uri = "http://localhost:3000/newpalya";
|
||||
string uri = url + "/newpalya";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "POST");
|
||||
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{ \"bevitel1\":\"Easy3\"}");
|
||||
@@ -271,6 +294,25 @@ public class DatabaseData : MonoBehaviour
|
||||
|
||||
yield return uwr.SendWebRequest();
|
||||
|
||||
if (uwr.isNetworkError) {
|
||||
Debug.Log(uwr.error);
|
||||
} else {
|
||||
//input.text = uwr.downloadHandler.text;
|
||||
Debug.Log(uwr.downloadHandler.text);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator IPostNewCoinData(ulong coins, int userid) {
|
||||
string uri = url + "/coinUpdate";
|
||||
|
||||
var uwr = new UnityWebRequest(uri, "POST");
|
||||
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+coins+",\"bevitel2\":"+userid+"}");
|
||||
uwr.uploadHandler = (UploadHandler)new UploadHandlerRaw(jsonToSend);
|
||||
uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
|
||||
uwr.SetRequestHeader("Content-Type", "application/json");
|
||||
|
||||
yield return uwr.SendWebRequest();
|
||||
|
||||
if (uwr.isNetworkError) {
|
||||
Debug.Log(uwr.error);
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,8 @@ public class PlayerController : MonoBehaviour
|
||||
{
|
||||
public Rigidbody rb; //jatekos teste
|
||||
private CameraController cc;
|
||||
private IsGrounded isGrounded;
|
||||
|
||||
public float jumpforce = 5f; //mekkorat tudjon ugorni
|
||||
private float sideMovement = 3f; //oldalra mennyit mozogjon
|
||||
private Vector3 direction; //jatkos pozicio
|
||||
@@ -17,13 +19,13 @@ public class PlayerController : MonoBehaviour
|
||||
private Vector2 startTouchPosition; //erintes kezdo pozicio
|
||||
private Vector2 endTouchPosition; //erintes vegpozicio
|
||||
|
||||
public ControllType activeControllType; //ezt kell atallitani hogy swipe-os vagy button-os legyen a mozgas
|
||||
public ControlType activeControllType; //ezt kell atallitani hogy swipe-os vagy button-os legyen a mozgas
|
||||
|
||||
public Button leftButton;
|
||||
public Button jumpButton;
|
||||
public Button rightButton;
|
||||
|
||||
public enum ControllType
|
||||
public enum ControlType
|
||||
{
|
||||
Swipe,
|
||||
Button
|
||||
@@ -31,16 +33,18 @@ public class PlayerController : MonoBehaviour
|
||||
|
||||
private void Awake() {
|
||||
cc = FindObjectOfType<CameraController>(); //kamera vezerlo referencia
|
||||
activeControllType = ControllType.Button;
|
||||
isGrounded = FindObjectOfType<IsGrounded>();
|
||||
|
||||
//activeControllType = ControlType.Button;
|
||||
}
|
||||
|
||||
public void setControllType(ControllType controlltype){
|
||||
public void setControllType(ControlType controlltype){
|
||||
activeControllType = controlltype;
|
||||
}
|
||||
|
||||
private void Update(){
|
||||
|
||||
if(activeControllType == ControllType.Swipe){
|
||||
if(activeControllType == ControlType.Swipe){
|
||||
leftButton.gameObject.SetActive(false);
|
||||
jumpButton.gameObject.SetActive(false);
|
||||
rightButton.gameObject.SetActive(false);
|
||||
@@ -59,7 +63,7 @@ public class PlayerController : MonoBehaviour
|
||||
timeSinceLastTap = 0f;
|
||||
}
|
||||
|
||||
if(isTapped && rb.transform.position.y <= 0.16f){
|
||||
if(isTapped && isGrounded.isGrounded){
|
||||
if(Time.time - timeSinceLastTap >= holdTime){ //ha nyomva tartotta a beallitott ideig
|
||||
Debug.Log("Long tapped");
|
||||
jump();
|
||||
@@ -84,7 +88,7 @@ public class PlayerController : MonoBehaviour
|
||||
goRight();
|
||||
}
|
||||
}
|
||||
}else if(activeControllType == ControllType.Button){
|
||||
}else if(activeControllType == ControlType.Button){
|
||||
//jumpforce = 100;
|
||||
/*leftButton.onClick.AddListener(goRight);
|
||||
jumpButton.onClick.AddListener(jump);
|
||||
@@ -119,9 +123,13 @@ public class PlayerController : MonoBehaviour
|
||||
}
|
||||
|
||||
public void jump(){
|
||||
if(rb.transform.position.y <= 0.16f)
|
||||
if(isGrounded.isGrounded){
|
||||
rb.AddForce(new Vector3(0, jumpforce, 0)); //ugras
|
||||
|
||||
isGrounded.isGrounded = false;
|
||||
}
|
||||
|
||||
Debug.Log("jumped");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -19,11 +19,13 @@ public class UsernameHandler : MonoBehaviour
|
||||
private StreamReader reader;
|
||||
private DatabaseData db;
|
||||
private PlayerList playerList;
|
||||
private CoinCounter cc;
|
||||
|
||||
private void Awake() {
|
||||
input.gameObject.SetActive(false);
|
||||
inputBackground.SetActive(false);
|
||||
path = Application.persistentDataPath + "/username.txt";
|
||||
cc = FindObjectOfType<CoinCounter>();
|
||||
db = FindObjectOfType<DatabaseData>();
|
||||
db.GetPlayerData();
|
||||
}
|
||||
@@ -54,6 +56,8 @@ public class UsernameHandler : MonoBehaviour
|
||||
userid = item.player_id;
|
||||
}
|
||||
}
|
||||
|
||||
db.GetCoinDataCall(userid);
|
||||
}
|
||||
|
||||
private void usernameCheck(){
|
||||
@@ -85,7 +89,11 @@ public class UsernameHandler : MonoBehaviour
|
||||
username = data;
|
||||
Debug.Log("username: " + username);
|
||||
|
||||
getId();
|
||||
getId();
|
||||
|
||||
//StartCoroutine(waitForCoins());
|
||||
|
||||
|
||||
|
||||
input.gameObject.SetActive(false);
|
||||
inputBackground.SetActive(false);
|
||||
@@ -93,4 +101,11 @@ public class UsernameHandler : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator waitForCoins(){
|
||||
yield return new WaitUntil(() => db.coins != 0);
|
||||
|
||||
cc.SetCoin(db.GetCoins(userid));
|
||||
Debug.Log("uh coin"+cc.coin);
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class jatekmanager : MonoBehaviour
|
||||
private UsernameHandler usernameHandler;
|
||||
private Score score;
|
||||
private Timer timer;
|
||||
private CoinCounter cc;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -44,6 +45,7 @@ public class jatekmanager : MonoBehaviour
|
||||
usernameHandler = FindObjectOfType<UsernameHandler>();
|
||||
score = FindObjectOfType<Score>();
|
||||
timer = FindObjectOfType<Timer>();
|
||||
cc = FindObjectOfType<CoinCounter>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@@ -156,6 +158,7 @@ public class jatekmanager : MonoBehaviour
|
||||
homeGomb.SetActive(false);
|
||||
settingsGomb.SetActive(false);
|
||||
shopGomb.SetActive(false);
|
||||
playButton.SetActive(false);
|
||||
UpdateGameState(GameState.Game);
|
||||
}
|
||||
|
||||
@@ -167,15 +170,18 @@ public class jatekmanager : MonoBehaviour
|
||||
|
||||
private async void HandleGame()
|
||||
{
|
||||
playButton.SetActive(false);
|
||||
StartCoroutine(TimerGame());
|
||||
|
||||
GetComponent <GroundController> ().enabled = true;
|
||||
GetComponent <PlayerController>().enabled = true;
|
||||
|
||||
goLeftButton.SetActive(true);
|
||||
jumpButton.SetActive(true);
|
||||
goRightButton.SetActive(true);
|
||||
scoreText.gameObject.SetActive(true);
|
||||
timerText.gameObject.SetActive(true);
|
||||
playButton.SetActive(false);
|
||||
|
||||
timer.playTime.Start();
|
||||
}
|
||||
|
||||
@@ -193,9 +199,11 @@ public class jatekmanager : MonoBehaviour
|
||||
//toltse fel az adatokat a run-rol
|
||||
db.PostNewScoreData(usernameHandler.userid, score.score, timer.convertTimeToString());
|
||||
|
||||
//coin feltoltes
|
||||
db.PostNewCoinData(cc.coin, usernameHandler.userid);
|
||||
|
||||
SceneUIManager.LoadScene(1); //HighScore scene
|
||||
|
||||
//
|
||||
|
||||
/*playButton.SetActive(false);
|
||||
homeGomb.SetActive(true);
|
||||
|
||||
Reference in New Issue
Block a user