Make bullets even greater, and make them explode

This commit is contained in:
Sofia 2019-08-04 02:45:55 +03:00
parent 66dec3d98c
commit 2daf97a490
2 changed files with 4825 additions and 57 deletions

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,12 @@ namespace Saltosion.OneWeapon.Bullets {
public class RevolverBullet : MonoBehaviour { public class RevolverBullet : MonoBehaviour {
public Rigidbody2D Body; public Rigidbody2D Body;
public GameObject Sprite;
public ParticleSystem Trail;
public ParticleSystem Explosion;
private float DeathTimer = 0;
void Start() { void Start() {
Vector2 Direction = GetComponent<Bullet>().Direction; Vector2 Direction = GetComponent<Bullet>().Direction;
@ -14,6 +20,15 @@ namespace Saltosion.OneWeapon.Bullets {
Body.velocity = Direction * 15; Body.velocity = Direction * 15;
Body.rotation = Rot - 90; Body.rotation = Rot - 90;
Explosion.Stop();
}
void Update() {
DeathTimer += Time.deltaTime;
if (DeathTimer > 20) {
Destroy(gameObject);
}
} }
void OnTriggerEnter2D(Collider2D collider) { void OnTriggerEnter2D(Collider2D collider) {
@ -21,8 +36,14 @@ namespace Saltosion.OneWeapon.Bullets {
// don't hit the player! // don't hit the player!
return; return;
} }
Destroy(gameObject); Destroy(Sprite);
Debug.Log("Boom!"); Destroy(Body);
Destroy(GetComponent<CapsuleCollider2D>());
Explosion.Play();
Trail.Stop();
DeathTimer = 19;
// Do damage here, kill everyone
} }
} }
} }