-
Notifications
You must be signed in to change notification settings - Fork 0
/
One_money.cs
130 lines (122 loc) · 2.94 KB
/
One_money.cs
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class One_money : MonoBehaviour
{
// Start is called before the first frame update
public GameObject opject;
public GameObject par;
private GameObject inst_obj;
public GameObject fold3;
public float timespwn;
private float t;
public float timeStart = 60;
public GameObject fold;
[SerializeField] Text scoret;
Vector3 fld3;
public GameObject prnt;
[SerializeField] Text label;
private void Start()
{
t = timespwn;
}
void Update()
{
fld3 = fold3.transform.position;
Vector3 f = fold.transform.position;
if (Caan())
{
if (timespwn <= 0)
{
if (timeStart - Time.deltaTime > 0)
{
if ((gameObject.name == "zavodm") && (label.text != "Broken"))
{
Vector3 pos = par.transform.position;
int rand = Random.Range(-10, 24);
inst_obj = Instantiate(opject, new Vector3(pos[0], pos[1] + 10f, pos[2]), Quaternion.identity) as GameObject;
inst_obj.transform.localScale = new Vector3(5f, 5f, 5f);
inst_obj.transform.parent = prnt.transform;
timespwn = t;
f[0] += 20;
}
else if ((gameObject.name == "zavodh") && (label.text != "Broken"))
{
Vector3 pos = par.transform.position;
int rand = Random.Range(-10, 24);
inst_obj = Instantiate(opject, new Vector3(pos[0], pos[1] + 10f, pos[2]), Quaternion.identity) as GameObject;
inst_obj.transform.localScale = new Vector3(5f, 5f, 5f);
inst_obj.transform.parent = prnt.transform;
timespwn = t;
f[0] += 40;
}
else if ((gameObject.name == "zavodw") && (label.text != "Broken"))
{
Vector3 pos = par.transform.position;
int rand = Random.Range(-10, 24);
inst_obj = Instantiate(opject, new Vector3(pos[0], pos[1] + 10f, pos[2]), Quaternion.identity) as GameObject;
inst_obj.transform.localScale = new Vector3(5f, 5f, 5f);
inst_obj.transform.parent = prnt.transform;
timespwn = t;
f[0] += 30;
}
timeStart -= Time.deltaTime;
}
}
else
{
timespwn -= Time.deltaTime;
}
}
if (timeStart - Time.deltaTime > 0)
{
timeStart -= Time.deltaTime;
}
fold.transform.position = f;
scoret.text = f[0].ToString();
}
bool Caan()
{
if (gameObject.name == "zavodm")
{
if (GameObject.Find("m(Clone)"))
{
//score += 1;
return false;
}
else
{
return true;
}
}
else if (gameObject.name == "zavodh")
{
if (GameObject.Find("h(Clone)"))
{
return false;
}
else
{
//score += 10;
return true;
}
}
else if (gameObject.name == "zavodw")
{
if (GameObject.Find("w(Clone)"))
{
return false;
}
else
{
//score += 5;
return true;
}
}
else
{
return true;
}
}
}