mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-05 11:53:08 +00:00
53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace RimWorldAnimationStudio
|
|
{
|
|
public class ActorCard : MonoBehaviour
|
|
{
|
|
public Dropdown genderDropdown;
|
|
public Dropdown bodyTypeDropdown;
|
|
public InputField bodyOffsetXField;
|
|
public InputField bodyOffsetZField;
|
|
public Toggle initiatorToggle;
|
|
public GameObject bodyPartsTags;
|
|
|
|
private AnimationDef animationDef;
|
|
private int actorID = 0;
|
|
|
|
public string bodyType
|
|
{
|
|
get
|
|
{
|
|
string _bodyType = bodyTypeDropdown.options[bodyTypeDropdown.value].text;
|
|
if (_bodyType == "") return "Male";
|
|
|
|
return _bodyType;
|
|
}
|
|
}
|
|
|
|
public void Initialize(AnimationDef animationDef, int actorID)
|
|
{
|
|
this.animationDef = animationDef;
|
|
this.actorID = actorID;
|
|
|
|
UpdateBodyType();
|
|
initiatorToggle.isOn = animationDef.actors[actorID].initiator;
|
|
}
|
|
|
|
public void UpdateBodyType()
|
|
{
|
|
bodyOffsetXField.text = animationDef.actors[actorID].bodyTypeOffset.GetOffset(bodyType).x.ToString();
|
|
bodyOffsetZField.text = animationDef.actors[actorID].bodyTypeOffset.GetOffset(bodyType).z.ToString();
|
|
}
|
|
|
|
public void UpdateAnimationDef()
|
|
{
|
|
animationDef.actors[actorID].initiator = initiatorToggle.isOn;
|
|
animationDef.actors[actorID].bodyTypeOffset.SetOffset(bodyType, new Vector2(float.Parse(bodyOffsetXField.text), float.Parse(bodyOffsetZField.text)));
|
|
}
|
|
}
|
|
}
|