- Home /
Particles passing through a set number of objects
Is it possible for a particle to say go through one enemy (killing it) and then stop and the second (killing it and destroying the particle). Currently my particles will disappear after hitting one object, but I want the weapon shooting the particles to level and with each level the particles can go through more and more enemies. I could do this fairly easily by using a game object as a bullet, but unfortunately I am incapable to making that move along towards where my mouse pointer is. I'm not sure if my code will help at all, but still.
The code dealing with the weapon is here
function Shotpistol(){
nextfire = Time.time+fireRate;
fireRate = 1.5-GameplayGlobals.cannonLevel/5;
particleEmitter.Emit((GameplayGlobals.cannonLevel*10) + 1);
audio.PlayOneShot(pistolshot);
target.GetComponent(iTweenEvent).GetEvent(target, "Shake").Play();
}
function SetUpPistol(){
gameObject.GetComponent(ParticleRenderer).particleRenderMode = ParticleRenderMode.Stretch;
particleEmitter.rndVelocity = Vector3(0,0,0);
gameObject.GetComponent(ParticleEmitter).localVelocity = Vector3(0,0,20);
gameObject.GetComponent(ParticleAnimator).sizeGrow = 2;
renderer.material = ShotMaterial;
yield;
}
And the collider
if(other.tag == "Enemy" || other.tag=="SideEnemy"){
if(GameplayGlobals.weapontype <= 0 || GameplayGlobals.weapontype >= 2)
other.SendMessageUpwards("ApplyDamage",100,SendMessageOptions.DontRequireReceiver);
And finally is applying the damage
function ApplyDamage (liferested:int) {
if(gameObject.tag=="Enemy" || gameObject.tag=="SideEnemy"){
Life-=liferested;
}
Comment