private void OnEnable() { //todo particles gameManager = stateManager.gameManager; explosionTick = Time.time + bombTimerLegth.value; var particle = mainParticle.main; var particles = mainParticle.subEmitters; particle.startLifetime = bombTimerLegth.value; for (int i = 0; i < particles.subEmittersCount; i++) { var emitter = particles.GetSubEmitterSystem(i).main; emitter.startDelay = bombTimerLegth.value; } mainParticle.Play(); exploded = false; if (ownerBrain) { ownerBrain.AddActiveBomb(this); } }
private void OnEnable() { //TODO particles and systems gameManager = stateManager.gameManager; explosionTick = Time.time + bombTimerLength.value; var particle = mainParticle.main; particle.startLifetime = bombTimerLength.value; for (int i = 0; i < subParticles.Length; i++) { var emitter = subParticles[i].main; emitter.startDelay = bombTimerLength.value; if (BombRange.value == 1f) { emitter.startLifetime = 0.21f; emitter.startSpeed = new ParticleSystem.MinMaxCurve(1, 7); } if (BombRange.value == 2f) { emitter.startLifetime = 0.32f; emitter.startSpeed = new ParticleSystem.MinMaxCurve(1, 8); } if (BombRange.value == 3f) { emitter.startLifetime = 0.32f; emitter.startSpeed = new ParticleSystem.MinMaxCurve(1, 11); } if (BombRange.value == 4f) { emitter.startLifetime = 0.29f; emitter.startSpeed = new ParticleSystem.MinMaxCurve(1, 15); } if (BombRange.value == 5f) { emitter.startLifetime = 0.27f; emitter.startSpeed = new ParticleSystem.MinMaxCurve(1, 20); } if (BombRange.value == 6f) { emitter.startLifetime = 0.32f; emitter.startSpeed = new ParticleSystem.MinMaxCurve(1, 20); } if (BombRange.value == 7f) { emitter.startLifetime = 0.37f; emitter.startSpeed = new ParticleSystem.MinMaxCurve(1, 20); } } mainParticle.Play(); exploded = false; if (ownerBrain) { ownerBrain.AddActiveBomb(this); } if (CanKick.value == false) { rigidbody.isKinematic = true; gameObject.GetComponent <Collider>().enabled = false; } else { rigidbody.constraints = RigidbodyConstraints.FreezeAll; } }