public void attachEffect(AttractEffect attractTo, Vector3 pointOfAttraction, ParticleSystem effect, float force, float lifeTime) { particles = Instantiate(effect, gameObject.transform); particles.transform.position = pointOfAttraction; particles.Play(); attractionPoint = pointOfAttraction; attachEffect(attractTo, force, lifeTime); ragdoll(); }
public void attachEffect(AttractEffect attractTo, float force, float lifeTime) { rig = getRigidBody(); if (rig != null) { this.attractTo = attractTo; } this.force = force; startEffect(lifeTime); ragdoll(); }
public override void processPrimaryHit(Item item, GameObject hit, Vector3 hitPoint, Vector3 direction)//This is gross logic { if (other != null && other.gameObject == hit.gameObject) { return; } AttractEffect @this = hit.AddComponent <AttractEffect>(); @this.attachEffect(other, hitPoint, other == null?primaryOnHitEffect:secondaryOnHitEffect, force, effectLifeTime); if (other != null) { other.attachEffect(@this, force, effectLifeTime); other = null; } else { other = @this; } }