Exemplo n.º 1
0
    /// <summary>
    /// Trigged when the user has clicked and the ball has done it's actions
    /// This function create the particles that give feedback when the player clicks
    /// </summary>
    /// <param name="obj">Givven parameter that contains the ball direction and the current ball position</param>
    private void OnBallMoveParticle(Events.IBallMove 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);

            Vector2 dir;
            dir = obj.direction;

            float angle = Util.Common.VectorToAngle(dir);
            angle -= 180;

            for (int i = 0; i < pmcount; i++)
            {
                p = selected.Particles[i];
                if (p.velocity == Vector3.zero)
                {
                    dir                   = Util.Common.AngleToVector(angle + Random.Range(-10f, 10f));
                    p.position            = (dir * radius) + obj.position;
                    p.startSize           = 0.5f;
                    p.startLifetime       = 0.5f;
                    p.velocity            = dir * Random.Range(0.3f, 2f);
                    p.rotation            = Random.Range(0, 360f);
                    selected.Particles[i] = p;
                }
            }

            selected.System.SetParticles(selected.Particles, pmcount);
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// Actives click animation when the ball was clicked succesfull
 /// </summary>
 /// <param name="obj">Contains data about the balls current movement</param>
 private void OnBallMoveAnimator(Events.IBallMove obj)
 {
     animator.SetTrigger("click");
 }
Exemplo n.º 3
0
 void onBallClick(Events.IBallMove obj)
 {
     SFX_Click.PlayOneShot(SFX_ClickClip);
 }