New menu, added black background

This commit is contained in:
2025-08-03 11:19:23 +02:00
parent f2f002be7d
commit 0def50f9ad
58 changed files with 140069 additions and 109 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2d147b98c71693f43a4ee7a3e53c2cb9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,57 @@
using UnityEngine;
using System.Collections.Generic;
public class FireMovement : MonoBehaviour
{
[Tooltip("External light to flicker; you can leave this null if you attach script to a light")]
public new Light light;
[Tooltip("Minimum random light intensity")]
public float minIntensity = 0f;
[Tooltip("Maximum random light intensity")]
public float maxIntensity = 1f;
[Tooltip("How much to smooth out the randomness; lower values = sparks, higher = lantern")]
[Range(1, 50)]
public int smoothing = 5;
// Continuous average calculation via FIFO queue
// Saves us iterating every time we update, we just change by the delta
Queue<float> smoothQueue;
float lastSum = 0;
/// <summary>
/// Reset the randomness and start again. You usually don't need to call
/// this, deactivating/reactivating is usually fine but if you want a strict
/// restart you can do.
/// </summary>
public void Reset() {
smoothQueue.Clear();
lastSum = 0;
}
void Start() {
smoothQueue = new Queue<float>(smoothing);
// External or internal light?
if (light == null) {
light = GetComponent<Light>();
}
}
void Update() {
if (light == null)
return;
// pop off an item if too big
while (smoothQueue.Count >= smoothing) {
lastSum -= smoothQueue.Dequeue();
}
// Generate random new item, calculate new average
float newVal = Random.Range(minIntensity, maxIntensity);
smoothQueue.Enqueue(newVal);
lastSum += newVal;
// Calculate new smoothed average
light.intensity = lastSum / (float)smoothQueue.Count;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7c8ee8646e8614048bda31451c3efd3e