Files
Project-M/Packages/com.shadercrew.the-toon-shader.core/Scripts/Runtime/Demo/LightRotation.cs
T
kronic e362aaeb43 Import art/VFX asset packs + game-feel systems; normalize texture extensions to lowercase for LFS
Add BefourStudios SciFi environment packs, Gabriel Aguiar VFX, and the
ShaderCrew Toon Shader embedded packages, plus combat/enemy/wave/death
gameplay systems and supporting vault docs/screenshots.

Rename 11 vendor textures from uppercase .PNG/.HDR to lowercase so the
case-sensitive Git LFS filters (*.png/*.hdr) match on case-sensitive
filesystems (Linux CI, case-sensitive macOS), not just locally where
core.ignorecase=true masks the gap. Each .meta moved with its asset so
GUID references are preserved. All ~1000 binaries tracked via LFS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 22:50:43 -07:00

63 lines
1.5 KiB
C#

using System.Collections;
using UnityEngine;
namespace ShaderCrew.TheToonShader
{
public class LightRotation : MonoBehaviour
{
public float startAngle = -30f;
public float endAngle = 30f;
public float rotationSpeed = 1f;
public int pauseDuration = 500;
public int rotationAxis = 1;
private float t = 0f;
private bool reversing = false;
private bool isPaused = false;
void Update()
{
if (isPaused) return;
t += (reversing ? -1 : 1) * rotationSpeed * Time.deltaTime;
if (t >= 1f)
{
t = 1f;
reversing = true;
StartCoroutine(PauseAtMaxPoint());
}
else if (t <= 0f)
{
t = 0f;
reversing = false;
StartCoroutine(PauseAtMaxPoint());
}
float easedT = Mathf.SmoothStep(0f, 1f, t);
float angle = Mathf.Lerp(startAngle, endAngle, easedT);
Vector3 rotation = transform.eulerAngles;
if (rotationAxis == 0)
rotation.x = angle;
else if (rotationAxis == 1)
rotation.y = angle;
else if (rotationAxis == 2)
rotation.z = angle;
transform.eulerAngles = rotation;
}
private IEnumerator PauseAtMaxPoint()
{
isPaused = true;
yield return new WaitForSeconds(pauseDuration / 1000f);
isPaused = false;
}
}
}