1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using UnityEngine;
- public class DetonatorSprayHelper : MonoBehaviour
- {
- private void Start()
- {
- this.isReallyOn = base.GetComponent<ParticleEmitter>().emit;
- base.GetComponent<ParticleEmitter>().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<Renderer>().material = ((UnityEngine.Random.value <= 0.5f) ? this.secondMaterial : this.firstMaterial);
- }
- private void FixedUpdate()
- {
- if (Time.time > this.startTime)
- {
- base.GetComponent<ParticleEmitter>().emit = this.isReallyOn;
- }
- if (Time.time > this.stopTime)
- {
- base.GetComponent<ParticleEmitter>().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;
- }
|