Add fx fire and modify Beautify setup

This commit is contained in:
Williams
2026-08-05 14:58:45 +02:00
parent de47408e88
commit b5ff8d3527
727 changed files with 556565 additions and 20 deletions
@@ -0,0 +1,57 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LightFlicker : MonoBehaviour{
private float initialValue;//Initial light intensity value
private Vector3 initialPosition;//Initial transform position
private Vector3 initialScale;
private float initialTime;//Initial time offset allows each instance of the fires to appear to flicker differently
private Light lightRef;
public float amount = 0.01f;//Amount to ajust intensity of light
public float speed = 8;//speed at which to ajust intensity
public bool adjustLocation;//do we want to randomly offset this position?
public float locationAdjustAmount = 1;
public bool adjustScale = false;
public float scaleAdjustAmount = 1;
public Transform scaleObject;//Incase the scale needs to be applied to a different transform
void Start () {
initialTime = Random.value*100;//Get random offset
lightRef = gameObject.GetComponent<Light>();
if (lightRef) {
initialValue = lightRef.intensity;
}
if(scaleObject == false){
scaleObject = transform;
}
initialPosition = transform.position;
initialScale = scaleObject.localScale;
}
void Update () {
float intensityNoise = Mathf.PerlinNoise(Time.time*speed, initialTime);
if(lightRef){//use perlin noise to ajust intensity
lightRef.intensity = initialValue + intensityNoise*amount;
}
if(adjustLocation){//use perlin noise to ajust position
Vector3 offset = new Vector3(
Mathf.PerlinNoise(Time.time*speed, initialTime + 5) - 0.5f,
intensityNoise - 0.5f,//reuse intensity noise for y offset
Mathf.PerlinNoise(Time.time*speed, initialTime + 10) - 0.5f);
transform.position = initialPosition + offset * locationAdjustAmount * 2;
}
if(adjustScale){//use perlin noise to ajust scale
scaleObject.localScale = initialScale * ((intensityNoise-0.5f)*scaleAdjustAmount + 1);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: af5d4a9da84f6475893ff9d9894d4a4a
timeCreated: 1517715194
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TileAnimation : MonoBehaviour{
public int xFrames = 4;//horizontal frames
public int yFrames = 4;//virtical frames
public float speed;//How many frames per second?
public bool billboard = true;//do we want to billboard this object?
public Camera mainCamera;
public bool useURPProps = true;
private int frame = 0;//current frame of animation
private Renderer rendererReference;
private int randomStart;//to offset each instance of this animation
void Awake () {
rendererReference = gameObject.GetComponent<Renderer>();
if (useURPProps )
{
rendererReference.materials[0].SetVector("TilingOffset", new Vector4(1.0f / xFrames, 1.0f / yFrames, 1f, 1f));
}
else
{
rendererReference.materials[0].mainTextureScale = new Vector2(1.0f / xFrames, 1.0f / yFrames);
}
if(billboard){
if(!mainCamera){
mainCamera = Camera.main;
}
}
randomStart = (int)(Random.value*xFrames*yFrames);
}
void Update () {
frame = (int)Mathf.Repeat(Mathf.FloorToInt(Time.time*speed) + randomStart, xFrames*yFrames);
int xOffset = frame % xFrames;
int yOffset = frame / xFrames;
if (useURPProps)
{
rendererReference.materials[0].SetVector("TilingOffset", new Vector4(1.0f / xFrames, 1.0f / yFrames, xOffset / (xFrames * 1.0f), 1 - (yOffset + 1) / (yFrames * 1.0f)));
}
else
{
rendererReference.materials[0].mainTextureOffset = new Vector2(xOffset / (xFrames * 1.0f), 1 - (yOffset + 1) / (yFrames * 1.0f));
}
if(billboard){
transform.LookAt(transform.position + mainCamera.transform.rotation * Vector3.forward,
mainCamera.transform.rotation * Vector3.up);
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 648143e2c7db84ef192fcfa75816ec6c
timeCreated: 1517715194
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: