8 using System.Collections;
10 namespace Valve.VR.InteractionSystem
15 public GameObject fireParticlePrefab;
16 public bool startActive;
17 private GameObject fireObject;
19 public ParticleSystem customParticles;
21 public bool isBurning;
23 public float burnTime;
24 public float ignitionDelay = 0;
25 private float ignitionTime;
29 public AudioSource ignitionSound;
31 public bool canSpreadFromThisSource =
true;
46 if ( ( burnTime != 0 ) && ( Time.time > ( ignitionTime + burnTime ) ) && isBurning )
49 if ( customParticles != null )
51 customParticles.Stop();
55 Destroy( fireObject );
62 void OnTriggerEnter( Collider other )
64 if ( isBurning && canSpreadFromThisSource )
66 other.SendMessageUpwards(
"FireExposure", SendMessageOptions.DontRequireReceiver );
72 private void FireExposure()
74 if ( fireObject == null )
76 Invoke(
"StartBurning", ignitionDelay );
79 if ( hand = GetComponentInParent<Hand>() )
81 hand.controller.TriggerHapticPulse( 1000 );
87 private void StartBurning()
90 ignitionTime = Time.time;
93 if ( ignitionSound != null )
98 if ( customParticles != null )
100 customParticles.Play();
104 if ( fireParticlePrefab != null )
106 fireObject = Instantiate( fireParticlePrefab, transform.position, transform.rotation ) as GameObject;
107 fireObject.transform.parent = transform;