using UnityEngine; using System.Collections; /* Todo - set duration and color properly (actually, i'm not sure this is possible) calculate count based on detail inherit velocity */ [RequireComponent (typeof (Detonator))] [AddComponentMenu("Detonator/Object Spray")] public class DetonatorSpray : DetonatorComponent { public GameObject sprayObject; public int count = 10; public float startingRadius = 0f; public float minScale = 1f; public float maxScale = 1f; private bool _delayedExplosionStarted = false; private float _explodeDelay; override public void Init() { //unused } void Update() { if (_delayedExplosionStarted) { _explodeDelay = (_explodeDelay - Time.deltaTime); if (_explodeDelay <= 0f) { Explode(); } } } private Vector3 _explosionPosition; private float _tmpScale; override public void Explode() { if (!_delayedExplosionStarted) { _explodeDelay = explodeDelayMin + (Random.value * (explodeDelayMax - explodeDelayMin)); } if (_explodeDelay <= 0) //if the delayTime is zero { int detailCount = (int)(detail * count); for (int i=0;i