help with public/private object specific variables please!

Hi, I’m still new to javascript, but what I’m tryin to do is allow the user to set objects on fire, basically any object I tag as ‘flammable’ should start spawning particles for a set amount of time and then stop.

I’ve two boxes tagged as flammable, both with particle emitters attached.

This is the script I’ve attached to each box:

private var burnableObject : GameObject;
private var burnHit : RaycastHit;
var propogateTime : int;
var surviveTime : int;

private var ignitedAtTime :  int;
private var thisIsOnFire : boolean = false;
private var currentTime : int;

function Update () 
	
	{
	
		if(Physics.Raycast (Camera.main.transform.position, Camera.main.transform.TransformDirection (0, 0,1), burnHit, 3))
			{
				if(burnHit.collider.gameObject.tag=="flammable"   Input.GetButton("ignite") )
					{
					
						ignitedAtTime = Time.time;
						thisIsOnFire = true;
						burnableObject = burnHit.collider.gameObject;
						
					}
			}
			
		if(thisIsOnFire == true)
			{
				if(Time.time < ignitedAtTime + surviveTime)
					{
						burnableObject.particleEmitter.Emit();
					}
					
				if(Time.time > ignitedAtTime + surviveTime)
					{
						thisIsOnFire = false;
						burnableObject.particleEmitter.Emit(0);
					}
					
			}
			
}

It does ignite the boxes, but when box 1 is on fire, and I ignite box 2, it disables box 1’s particles ahead of time.

I’m guessing I have misunderstood the use of private vars, as they seem to be applying to both objects simulataneously.

Is there some way of making those private vars into properties, so that even when I ignite box2, box1 will continue to burn for it’s specified time? (I’ve only ever programmed Lingo in Director).

private variables are basically properties, they don’t seem to be the problem here, otherwise the time variables would be the same also and object2 wouldn’t even disable object1’s emitter.
maybe the use the same particle emitter or burnableObject is set to the same gameObject?