new-horizons/NewHorizons/General/MarkerBuilder.cs
Nick J. Connors c977cb5333 Decluttered logs and added asteroid belts
Also includes some basic proc gen
2021-12-19 02:37:52 -05:00

27 lines
839 B
C#

using NewHorizons.External;
using OWML.Utils;
using System.Reflection;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.General
{
static class MarkerBuilder
{
public static void Make(GameObject body, string name, bool isMoon)
{
MapMarker MM = body.AddComponent<MapMarker>();
MM.SetValue("_labelID", (UITextType)Utility.AddToUITable.Add(name.ToUpper()));
if (isMoon)
{
MM.SetValue("_markerType", MM.GetType().GetNestedType("MarkerType", BindingFlags.NonPublic).GetField("Moon").GetValue(MM));
}
else
{
MM.SetValue("_markerType", MM.GetType().GetNestedType("MarkerType", BindingFlags.NonPublic).GetField("Planet").GetValue(MM));
}
}
}
}