-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollision.cs
41 lines (35 loc) · 922 Bytes
/
collision.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
using UnityEngine;
public class collision : MonoBehaviour
{
public move move;
public GameManager gameManager;
private Rigidbody rb;
void OnCollisionEnter (Collision collisionInfo)
{
if (collisionInfo.collider.tag == "obsatacle") //yes i spelled it incorrectly
{
move.enabled = false;
Time.timeScale = 0f;
gameManager.gameover();
}
if (collisionInfo.collider.tag == "EBullet")
{
move.enabled = false;
Time.timeScale = 0f;
gameManager.gameover();
}
}
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
if (transform.position.y < -1f)
{
move.enabled = false;
Time.timeScale = 0f;
gameManager.gameover();
}
}
}