-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameManager.cs
More file actions
84 lines (69 loc) · 1.98 KB
/
GameManager.cs
File metadata and controls
84 lines (69 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
public static GameManager Instance;
public GameObject arkaplanPanel;
public GameObject kazandinPanel;
public GameObject kaybettinPanel;
public int hedef;
public int hamleSayisi;
public int puanlar;
public bool oyunBittimi;
public TMP_Text puanlarTxt;
public TMP_Text hamleTxt;
public TMP_Text hedefTxt;
private void Awake()
{
Instance = this;
}
public void Initialize(int _hamleSayisi, int _hedef)
{
hamleSayisi = _hamleSayisi;
hedef = _hedef;
}
// Update is called once per frame
void Update()
{
puanlarTxt.text = "Puan: " + puanlar.ToString();
hamleTxt.text = "Hamle:" + hamleSayisi.ToString();
hedefTxt.text = "Hedef: " + hedef.ToString();
}
public void ProcessTurn(int _alinacakPuan, bool _hamleAzalt)
{
puanlar += _alinacakPuan;
if(_hamleAzalt)
{
hamleSayisi --;
if(puanlar >= hedef)
{
oyunBittimi = true;
arkaplanPanel.SetActive(true);
kazandinPanel.SetActive(true);
LambaSahnesi.instance.lambaParent.SetActive(false);
return;
}
if (hamleSayisi == 0)
{
oyunBittimi = true;
arkaplanPanel.SetActive(true);
kaybettinPanel.SetActive(true);
LambaSahnesi.instance.lambaParent.SetActive(false);
return;
}
}
}
//kazanirsan bu ekran gelecek
public void oyunuKazandin()
{
SceneManager.LoadScene(0);
}
//kaybedersen bu ekran gelecek
public void oyunuKaybettin()
{
SceneManager.LoadScene(0);
}
}