new-horizons/Marshmallow/General/MakeMapMarker.cs
Mister_Nebula dc23ac2de8 Massive rewrite
- Added moon support
- Rewrote every class for readability
- Rewrote Main class to simplify code (file planets now load on scene load)
2020-06-11 19:41:39 +01:00

26 lines
807 B
C#

using Marshmallow.External;
using OWML.ModHelper.Events;
using System.Reflection;
using UnityEngine;
namespace Marshmallow.General
{
static class MakeMapMarker
{
public static void Make(GameObject body, IPlanetConfig config)
{
MapMarker MM = body.AddComponent<MapMarker>();
MM.SetValue("_labelID", (UITextType)Utility.AddToUITable.Add(config.Name));
if (config.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));
}
}
}
}