FreeBeerGames/Solobot — pull request #17 by CoryG89 (2013-04-06 23:00:11+00:00)
Title: Upgrading Shooting Mechanic

## Changelog

* Added a `ParticleSystem` object named **Energy Ball** created with the new **Shruikan Particle System** editor included with Unity 3.5. This *is* different than the older method for creating particle systems which I used to create the **JetStream prefab** in an earlier commit.

* Also added another `ParticleSystem` object named **Explosion** which is instantiated whenever the projectile makes contact with another collider. I am currently using an optimized second version of this `ParticleSystem` that I came up with that is currently titled Explosion2.

* This is all controlled by a simple little script named `EnergyBall.js` that I wrote upand attached to the EnergyBall ParticleSystem. It is located in the Scripts directory named EnergyBall.js. It is attached to the **Energy Ball** prefab. It has an `OnCollisionEnter()` function which is called when it collides and handles the following:

* It instantiates its explosion effect, currently the **Explosion2** `ParticleSystem`.
* It checks if the object it hit is tagged as an `Enemy` and if so deals damage,
* After this processing the EnergyBall script destroys its `gameObject`.

* The `EnergyBall.js` script also contains a definition for a `Start()` and `Update()` function. The `Start()` function is called when the Energy Ball `GameObject` is created and simply records the position of its transform, `transform.position`, when it is created as `startPosition`. The `Update()` function gets the distance between the current `transform.position` and `startPosition` using the static `Vector3.Distance(v1, v2)` method. If the distance is greater than a certain threshold the object is destroyed. This helps mitigate lots of objects being instantiated if the bullets miss and keep going forever.

* I am also adding Long, Medium, and Short
platforms that I created based on the platforms that Joshua added.