liquid star
This commit is contained in:
1 parent
ba45c55d48
commit
b261f4d3d0
20 files changed
+1049
-18
No files matched your search
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FlickerLight : MonoBehaviour {
|
||||
[SerializeField] float baseIntensity = 8f;
|
||||
[SerializeField] float flickerAmount = 2f;
|
||||
[SerializeField] float speed = 1.5f;
|
||||
|
||||
Light _light;
|
||||
float _offset;
|
||||
|
||||
void Start() {
|
||||
_light = GetComponent<Light>();
|
||||
if (_light) baseIntensity = _light.intensity;
|
||||
_offset = Random.value * 100f;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (!_light) return;
|
||||
|
||||
float t = Time.time * speed + _offset;
|
||||
float noise = Mathf.PerlinNoise(t, _offset) * 2f - 1f;
|
||||
noise += (Mathf.PerlinNoise(t * 2.7f, _offset + 50f) * 2f - 1f) * 0.4f;
|
||||
|
||||
_light.intensity = baseIntensity + noise * flickerAmount;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a72f06e9fb1242edad819207c87af405
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user