Hi guys, I have my game menue, and im trying to create a lashing light to create distant explosion effect and need help creating a random flashing effect.
using UnityEngine;
using System.Collections;
public class Lightflash : MonoBehaviour {
public Light testLight;
public float FlashIntensity = 8.0;
public float FlashTime = 0.5f;
public float FlashZero = 0;
void Start() {
testLight.intensity = 0f;
}
void Update () {
//make light flash from ) to 8.0 over time.
testLight.intensity = FlashIntensity * FlashTime * Time.deltaTime;
// once lihgt is at Maximum strength, hold for a short time.
StartCoroutine(Flashtime());
}
void Dullflash(){
// decrease light intensity from maximum amount to zero.
testLight.intensity = FlashZero - FlashTime * Time.deltaTime;
}
IEnumerator Flashtime (){
yield return new WaitForSeconds(0.3);
Dullflash;
}
}