public void OnScoredPoint(Events.IScore obj) { for (int j = 0; j < noOfActiveParticleSystems; j++) { ParticleSystemStruct selected = Systems[j]; selected.setup(); selected.System.Emit(Random.Range(2, 5)); ParticleSystem.Particle p; int pmcount = selected.System.GetParticles(selected.Particles); Vector3 dir; Vector3 newPos; for (int i = 0; i < pmcount; i++) { p = selected.Particles[i]; if (p.velocity == Vector3.zero) { dir = Util.Common.AngleToVector(angle + Random.Range(arcSize / -2f, arcSize / 2f)); newPos = (dir * radius) + transform.position; newPos.z = -3f; p.startSize = 0.5f; p.startLifetime = 0.5f; p.velocity = dir * Random.Range(0.9f, 4f); p.rotation = Random.Range(0, 360f); selected.Particles[i] = p; } } selected.System.SetParticles(selected.Particles, pmcount); } }
/// <summary> /// Event Handler for IScore /// </summary> /// <param name="obj">object argement is not releivant for this event as it does not contain anything</param> private void AddPoint(Events.IScore obj) { int addScore = obj.bounces + 1; if (obj.lastDir.y < -0.3) { addScore++; } score += addScore; if (OnScoreUpdate != null) { OnScoreUpdate(); } }
void onBallScore(Events.IScore obj) { SFX_BallScore.PlayOneShot(SFX_BallScoreClip); }