using System; using UnityEngine; public class DetonatorSprayHelper : MonoBehaviour { private void Start() { this.isReallyOn = base.GetComponent().emit; base.GetComponent().emit = false; this.startTime = UnityEngine.Random.value * (this.startTimeMax - this.startTimeMin) + this.startTimeMin + Time.time; this.stopTime = UnityEngine.Random.value * (this.stopTimeMax - this.stopTimeMin) + this.stopTimeMin + Time.time; base.GetComponent().material = ((UnityEngine.Random.value <= 0.5f) ? this.secondMaterial : this.firstMaterial); } private void FixedUpdate() { if (Time.time > this.startTime) { base.GetComponent().emit = this.isReallyOn; } if (Time.time > this.stopTime) { base.GetComponent().emit = false; } } public float startTimeMin; public float startTimeMax; public float stopTimeMin = 10f; public float stopTimeMax = 10f; public Material firstMaterial; public Material secondMaterial; private float startTime; private float stopTime; private bool isReallyOn; }