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:
43
Assets/Scripts/World/Difficulty.cs
Normal file
43
Assets/Scripts/World/Difficulty.cs
Normal file
@ -0,0 +1,43 @@
|
||||
namespace GrassCutter
|
||||
{
|
||||
/// <summary>
|
||||
/// How big Herbaria-7 is. The ball keeps its 163 830 sectors whatever its size, so a smaller ball has smaller sectors
|
||||
/// too: less grass all round and every sector done sooner. The host picks it for a new save, it stays with the save,
|
||||
/// and everyone who joins gets the host's ball. 0 is the whole planet, as every save from before there was a choice.
|
||||
/// </summary>
|
||||
public enum Difficulty : byte { Hazard = 0, HoldMyBeer = 1, Mommy = 2 }
|
||||
|
||||
public static class Difficulties
|
||||
{
|
||||
/// <summary>Easiest first, the way the choice is offered.</summary>
|
||||
public static readonly Difficulty[] Order = { Difficulty.Mommy, Difficulty.HoldMyBeer, Difficulty.Hazard };
|
||||
|
||||
public static string Name(Difficulty d) =>
|
||||
d == Difficulty.Mommy ? "Mommy, I'm Scared!" : d == Difficulty.HoldMyBeer ? "Hold My Beer!" : "I AM THE FUCKING HAZARD!";
|
||||
|
||||
public static string Tag(Difficulty d) => Loc.T(d == Difficulty.Mommy ? Loc.N("EASY") : d == Difficulty.HoldMyBeer ? Loc.N("NORMAL") : Loc.N("EXTRA HARD"));
|
||||
|
||||
public static string Blurb(Difficulty d) => Loc.T(
|
||||
d == Difficulty.Mommy ? Loc.N("A planet a third the size, with sectors to match. Earth can wait a little.")
|
||||
: d == Difficulty.HoldMyBeer ? Loc.N("Half the planet, half-size sectors. Still a lot of lawn.")
|
||||
: Loc.N("The whole of Herbaria-7, full-size sectors, every blade of it."));
|
||||
|
||||
/// <summary>The planet's radius against the whole one.</summary>
|
||||
public static float Scale(Difficulty d) => d == Difficulty.Mommy ? 1f / 3f : d == Difficulty.HoldMyBeer ? 0.5f : 1f;
|
||||
|
||||
/// <summary>What the next new save starts on: set by the menu (and `-difficulty 0..2` for the dev bots).</summary>
|
||||
public static Difficulty Chosen = Difficulty.Hazard;
|
||||
|
||||
/// <summary>The ball the world is built on right now.</summary>
|
||||
public static Difficulty Current { get; private set; } = Difficulty.Hazard;
|
||||
|
||||
/// <summary>Builds the world on the ball for this difficulty, if it isn't on it already.</summary>
|
||||
public static void Apply(Difficulty d)
|
||||
{
|
||||
if (d != Difficulty.Mommy && d != Difficulty.HoldMyBeer) d = Difficulty.Hazard;
|
||||
if (d == Current) return;
|
||||
Current = d;
|
||||
Planet.Rescale(GameDefs.PlanetRadius * Scale(d));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user