CowMesh.cs
namespace NiuLai;
/// <summary>Bootleg box cow — the movie is famous for this quality bar.</summary>
public static class CowMesh
{
public static readonly Color Calf = new( 0.92f, 0.42f, 0.32f );
public static readonly Color Mom = new( 0.85f, 0.55f, 0.28f );
public static readonly Color Dad = new( 0.72f, 0.42f, 0.18f );
public static readonly Color Peer = new( 0.88f, 0.48f, 0.36f );
public static readonly Color Herd = new( 0.80f, 0.52f, 0.26f );
public static readonly Color Horn = new( 0.45f, 0.32f, 0.62f );
public static readonly Color Hoof = new( 0.95f, 0.92f, 0.88f );
public static readonly Color Nose = new( 0.95f, 0.88f, 0.82f );
public static GameObject Build( GameObject parent, Color hide, float scale = 1f )
{
var root = new GameObject( true, "mesh" );
root.SetParent( parent, false );
root.LocalPosition = 0;
root.LocalScale = 1;
Part( root, "body", new Vector3( 0, 0, 22 ), new Vector3( 1.35f, 0.62f, 0.72f ), hide, scale );
Part( root, "hump", new Vector3( -6, 0, 36 ), new Vector3( 0.55f, 0.40f, 0.22f ), hide * 0.92f, scale );
Part( root, "head", new Vector3( 30, 0, 30 ), new Vector3( 0.48f, 0.42f, 0.42f ), new Color( hide.r + 0.06f, hide.g + 0.05f, hide.b + 0.03f ), scale );
Part( root, "snout", new Vector3( 44, 0, 26 ), new Vector3( 0.28f, 0.26f, 0.20f ), Nose, scale );
Part( root, "earL", new Vector3( 26, 10, 38 ), new Vector3( 0.10f, 0.18f, 0.08f ), hide * 0.85f, scale );
Part( root, "earR", new Vector3( 26, -10, 38 ), new Vector3( 0.10f, 0.18f, 0.08f ), hide * 0.85f, scale );
Part( root, "hornL", new Vector3( 24, 8, 44 ), new Vector3( 0.07f, 0.07f, 0.28f ), Horn, scale );
Part( root, "hornR", new Vector3( 24, -8, 44 ), new Vector3( 0.07f, 0.07f, 0.28f ), Horn, scale );
Part( root, "legFL", new Vector3( 16, 12, 8 ), new Vector3( 0.16f, 0.16f, 0.36f ), Hoof, scale );
Part( root, "legFR", new Vector3( 16, -12, 8 ), new Vector3( 0.16f, 0.16f, 0.36f ), Hoof, scale );
Part( root, "legBL", new Vector3( -16, 12, 8 ), new Vector3( 0.16f, 0.16f, 0.36f ), Hoof, scale );
Part( root, "legBR", new Vector3( -16, -12, 8 ), new Vector3( 0.16f, 0.16f, 0.36f ), Hoof, scale );
Part( root, "tail", new Vector3( -38, 0, 26 ), new Vector3( 0.42f, 0.08f, 0.08f ), hide * 0.8f, scale );
return root;
}
static void Part( GameObject parent, string name, Vector3 local, Vector3 scale, Color tint, float cowScale )
{
var go = new GameObject( true, name );
go.SetParent( parent, false );
go.LocalPosition = local * cowScale;
go.LocalScale = scale * cowScale;
var mr = go.Components.Create<ModelRenderer>();
mr.Model = Primitives.BoxModel;
mr.MaterialOverride = Primitives.TintMat;
mr.Tint = tint;
}
}