rimworld-animation-studio/Assets/Scripts/AnimationComponents/BodyTypeOffset.cs

34 lines
1.1 KiB
C#

using System.Reflection;
using UnityEngine;
//using Microsoft.Toolkit.Uwp.UI;
namespace RimWorldAnimationStudio
{
public class BodyTypeOffset
{
public string Male;
public string Female;
public string Thin;
public string Hulk;
public string Fat;
public Vector3 GetOffset(string bodyType)
{
Debug.Log(bodyType);
FieldInfo bodyTypeOffsetInfo = typeof(BodyTypeOffset).GetField(bodyType);
string bodyTypeOffsetString = (string)bodyTypeOffsetInfo.GetValue(this);
if (bodyTypeOffsetString == null || bodyTypeOffsetString == "")
{ return new Vector2(); }
bodyTypeOffsetString = bodyTypeOffsetString.Trim();
bodyTypeOffsetString = bodyTypeOffsetString.Replace("(", "");
bodyTypeOffsetString = bodyTypeOffsetString.Replace(")", "");
var bodyTypeOffsetStrings = bodyTypeOffsetString.Split(',');
return new Vector3(float.Parse(bodyTypeOffsetStrings[0]), 0f, float.Parse(bodyTypeOffsetStrings[1]));
}
}
}