void OnCollisionEnter(Collision col) { ParticleMan.Emit(0, Random.Range(2, 6), transform.position, col.contacts[0].normal); ParticleMan.Emit(2, Random.Range(1, 4), transform.position, (GetComponent <Rigidbody>().velocity.normalized * .5f + col.contacts[0].normal)); if (col.transform.CompareTag("Destructable")) { _rb.velocity = _oldVelocity * .9f; col.gameObject.GetComponent <DestructableBehaviour>().TakeDamage(col.relativeVelocity.magnitude, col); StartCoroutine(Die()); } else { StartCoroutine(Die()); _lr.widthMultiplier = _lr.widthMultiplier * .7f; if (_canDoyng) { _canDoyng = false; if (col.transform.CompareTag("Statue")) { AudioMan.PlaySound(SoundName.BulletImapct, transform.position); } else { AudioMan.PlaySound(SoundName.Ricochet, transform.position); } } } }
void OnCollisionEnter(Collision col) { if (col.transform.CompareTag("Bullet") || col.impulse.magnitude > BreakForce) { if (col.contacts[0].thisCollider.gameObject.name != name) { GetNearest(col.contacts[0].point, col.impulse.magnitude, col.transform.CompareTag("Bullet") ? 8 : 1); ParticleMan.Emit(3, 5, col.contacts[0].point, Vector3.up); AudioMan.PlaySound(SoundName.StoneCrunch, col.contacts[0].point); } } }
public void PullTrigger() { GameObject bullet = Instantiate(BulletPrefab); AudioMan.PlaySound(SoundName.GunFired); bullet.transform.position = FunPoint.position; bullet.GetComponent <Rigidbody>().velocity = FunPoint.forward * BulletSpeed; transform.localPosition -= Vector3.forward * recoil.z; transform.Rotate(Vector3.right, recoil.x); MakeParticleLine(); StartCoroutine(FlashGun()); }