Added a light flicker

Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
RosimInc 2015-08-22 17:13:33 -04:00
parent a31eab5996
commit c0ee9a7b78
10 changed files with 18 additions and 76 deletions

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 9264b7464f0b2a04d951cf9fbfef3019
folderAsset: yes
timeCreated: 1440262930
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: a982ca76f16291a469a3532007a4cb13
timeCreated: 1440262931
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -1,55 +0,0 @@
fileFormatVersion: 2
guid: d8eead0b348e6814d877c5d98b8fb4fa
timeCreated: 1440264201
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 1
externalNormalMap: 1
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 2
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2
guid: 11cc80c6443f5ea4190c0041d3858a7e
timeCreated: 1440263521
guid: cffa81ba5df21ac4f8d31f5bed357ce1
timeCreated: 1440275417
licenseType: Free
NativeFormatImporter:
userData:

Binary file not shown.

View File

@ -4,15 +4,29 @@ using System.Collections;
[RequireComponent(typeof(Light))]
public class LightOnOff : MonoBehaviour {
private Light light;
private Light light;
private float intensity;
private float flicker;
// Use this for initialization
void Start () {
light = GetComponent<Light>();
light = GetComponent<Light>();
intensity = light.intensity;
}
// Update is called once per frame
void Update () {
flicker -= Time.deltaTime;
if (flicker <= 0)
{
light.intensity = intensity * 0.8f;
if (Random.value <= 0.3f)
flicker = Random.Range(0.4f, 1.5f);
}
else
light.intensity = intensity;
if(Input.GetKeyDown(KeyCode.Space))
light.enabled = !light.enabled;
}