Grass Cutters Together: the project as of moon-sweepers f3666f0
A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date. Images, audio, models and binaries go through Git LFS (.gitattributes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
22
Assets/Scripts/World/Spin.cs
Normal file
22
Assets/Scripts/World/Spin.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace GrassCutter
|
||||
{
|
||||
/// <summary>Endless spin about a local axis for windmill sails, weather vanes and other set dressing, with an optional 3D loop sound.</summary>
|
||||
public class Spin : MonoBehaviour
|
||||
{
|
||||
public Vector3 axis = Vector3.up;
|
||||
public float degreesPerSecond = 60f;
|
||||
public string loopClip;
|
||||
public float loopVolume = 0.25f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
// desync identical pieces
|
||||
transform.Rotate(axis, Random.Range(0f, 360f), Space.Self);
|
||||
if (!string.IsNullOrEmpty(loopClip) && !Application.isBatchMode) Sfx.Loop(loopClip, transform, loopVolume);
|
||||
}
|
||||
|
||||
void Update() => transform.Rotate(axis, degreesPerSecond * Time.deltaTime, Space.Self);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user