-
Notifications
You must be signed in to change notification settings - Fork 0
/
Yapay_zeka.cs
40 lines (30 loc) · 943 Bytes
/
Yapay_zeka.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
public class Enemy_Move : MonoBehaviour
{
public GameObject enemy;
public GameObject Sınır1;
public GameObject Sınır2;
public float enemy_hiz = 0.1f;
bool goRight = true;
void Start() {
}
void Update()
{
if (goRight)
{
enemy.transform.position = new Vector3(enemy.transform.position.x + enemy_hiz, transform.position.y);
}
else
{
enemy.transform.position = new Vector3(enemy.transform.position.x - enemy_hiz, transform.position.y);
}
float sınır1 = Sınır1.transform.position.x;
float sınır2 = Sınır2.transform.position.x;
if (enemy.transform.position.x < sınır1) {
goRight = true;
}
if (enemy.transform.position.x > sınır2) {
goRight = false;
Debug.Log(enemy.transform.position.x - enemy_hiz);
}
}
}