BulletLifeTime
How do I use Bullet Life Time
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
18 | StartCoroutine("BulletLifeTime"); | 1 |
43 | IEnumerator BulletLifeTime() | 2 |
File name: EnemyBullet.cs
Copy
14 public void ShootMe(Vector3 startPos, Vector3 dirrection, float speed = 7)
15 {
16 transform.position = startPos;
17 rb.velocity = dirrection * speed;
18 StartCoroutine("BulletLifeTime");
19 }
File name: EnemyBullet.cs
Copy
43 IEnumerator BulletLifeTime()
44 {
45 yield return new WaitForSeconds(10);
46 BulletIsOff();
47 }
BulletLifeTime 97 lượt xem
Gõ tìm kiếm nhanh...