void PlayerShoot() { ballAudio.clip = hit; ballAudio.volume = charge_up_time / max_charge_up_time; ballAudio.Play(); //PLay audio effect. //Debug.Log (lives); if (b_physics != null) { b_physics.Shoot(direction + direction_penalty, curve, charge_up_time / max_charge_up_time); //shoot the ball. } //Activate particle system if it is attached: if (smoke != null) { //var main = Smoke.main; float c = charge_up_time / (10 * max_charge_up_time); var main = smoke.main; main.startColor = new Color(c, c, c, 1.0f); smoke.Play(); //Edit the initial start color depending on speed. } has_kicked = true; }