private void OnParticleCollision(GameObject other) { ParticleSystem particleSystem = other.GetComponent <ParticleSystem>(); if (particleSystem != null) { if (collisionEvents != null) { int numCollisionEvents = particleSystem.GetCollisionEvents(gameObject, collisionEvents); int i = 0; while (i < numCollisionEvents) { ParticleSystem.Particle[] particles = new ParticleSystem.Particle[particleSystem.main.maxParticles]; int numParticlesAlive = particleSystem.GetParticles(particles); for (int j = 0; j < numParticlesAlive; j++) { particles[j].remainingLifetime = 0; } ParticleDamage particleDamage = other.GetComponent <ParticleDamage>(); if (particleDamage != null) { health.Damage(particleDamage.damage); } i++; } } } }
private void OnParticleCollision(GameObject other) { GameObject parent = other.GetComponent <ParticleParent>().parent; ParticleDamage particleDamage = parent.GetComponent <ParticleDamage>(); float damage = particleDamage.Damage(other.name, parent); if (!data.dead) { TakeDamage(damage, false); } }
void Start() { m_particleSystem = GetComponent<ParticleSystem>(); m_audio = GetComponent<AudioSource>(); if (!m_particleSystem) { Debug.Log(GetType().Name + " : No particle system attached. Disabling"); enabled = false; } m_particleDamage = GetComponent<ParticleDamage>(); m_particleDamage.enabled = false; Invoke("StartEffect", m_activationDelay); }
void Start() { m_particleSystem = GetComponent <ParticleSystem>(); m_audio = GetComponent <AudioSource>(); if (!m_particleSystem) { Debug.Log(GetType().Name + " : No particle system attached. Disabling"); enabled = false; } m_particleDamage = GetComponent <ParticleDamage>(); m_particleDamage.enabled = false; Invoke("StartEffect", m_activationDelay); }
private void OnParticleCollision(GameObject other) { ParticleSystem particleSystem = other.GetComponent <ParticleSystem>(); if (particleSystem != null) { int numCollisionEvents = particleSystem.GetCollisionEvents(gameObject, collisionEvents); int i = 0; while (i < numCollisionEvents) { ParticleDamage particleDamage = other.GetComponent <ParticleDamage>(); if (particleDamage != null) { Vector3 hitPosition = collisionEvents[i].intersection; GameObject particle = Instantiate(particleDamage.damageParticleObject, hitPosition, Quaternion.identity, parentTransform); } i++; } } }
// Start is called before the first frame update void Start() { Particle = GunPoint.GetComponent <ParticleSystem>(); PD = Particle.gameObject.GetComponent <ParticleDamage>(); }