-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDestroyBullets.cs
42 lines (35 loc) · 944 Bytes
/
DestroyBullets.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestroyBullets : MonoBehaviour
{
// Start is called before the first frame update
public float BulletLife = 0.5f; //характеристкка
public Animator anim;
public int ThisBulletDamage;
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == "Player")
{
CharControl.hp = CharControl.hp - ThisBulletDamage;
}
this.gameObject.GetComponent<Rigidbody2D>().velocity = Vector3.zero;
anim.SetBool("hui", true);
}
void Start()
{
Invoke("animbul", BulletLife);
}
public void animbul()
{
anim.SetBool("hui", true);
}
public void DestroyBul()
{
Destroy(this.gameObject);
}
// Update is called once per frame
void Update()
{
}
}