Carry a value in a gameObject to another third

Hi everyone,

I have this:

public float firePower;

On a cannon.
The Cannon instantiates a cannonball. Once the cannonball touches the ground, it instantiates an explosion.

I need to find a way to carry the value “firePower” of my cannon to the explosion. I must also consider that there are up to three distinct cannons, and up to three distinct cannonball; each has to be linked with its own cannon.

So:
Cannon1 firepower > cannonball > explosion.

Anyone has a suggestion how I might do that?

Something like this ought to work.

  var newexplosion : GameObject = Instantiate(canonBallObject, 
                                      transform.position, transform.rotation);
  var ExplosionScript = newexplosion.GetComponent(explosionScript);
  ExplosionScript.setDamage( firePower);

Where the explosion has a script called “explosionScript” with a function “setDamage()”.