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:
NiemandKG
2026-11-06 18:44:40 +06:00
parent 0f0467cd0c
commit d1c3761e58
4190 changed files with 270757 additions and 1 deletions

View File

@ -0,0 +1,47 @@
using UnityEngine;
namespace GrassCutter
{
/// <summary>A belt piece with a choice to make: the modes it can switch between.</summary>
public interface IJunction
{
int ModeCount { get; }
string ModeName(int mode);
Color ModeColor(int mode);
}
/// <summary>E on a splitter or a merger switches what it does, and the little sign on it shows which.</summary>
public class Junction : MonoBehaviour, IInteractable
{
public Renderer sign;
BuildPiece _piece;
IJunction _junction;
MaterialPropertyBlock _mpb;
int _shown = -1;
static readonly int BaseColor = Shader.PropertyToID("_BaseColor");
BuildPiece Piece => _piece ? _piece : (_piece = GetComponent<BuildPiece>());
IJunction Parts => _junction ?? (_junction = GetComponentInChildren<IJunction>());
public string Prompt => Loc.F("{0}: {1} (E changes it)", Piece.Def.name, Parts.ModeName(Piece.Mode.Value));
public bool CanInteract => true;
public void Interact()
{
Piece.NextModeRpc(Parts.ModeCount);
Sfx.Play("ui_click", 0.7f);
}
void Update()
{
int mode = Piece.Mode.Value;
if (mode == _shown || !sign) return;
_shown = mode;
if (_mpb == null) _mpb = new MaterialPropertyBlock();
sign.GetPropertyBlock(_mpb);
_mpb.SetColor(BaseColor, Parts.ModeColor(mode));
sign.SetPropertyBlock(_mpb);
}
}
}