mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Actor addons and animation
- Includes addons for hands and sex toys - WIP and very buggy
This commit is contained in:
parent
d9e6288e3a
commit
cd4711a8e5
400 changed files with 10269 additions and 661 deletions
51
Assets/Scripts/GUI/ActorAddonCard.cs
Normal file
51
Assets/Scripts/GUI/ActorAddonCard.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class ActorAddonCard : MonoBehaviour
|
||||
{
|
||||
public string addonName;
|
||||
public InputField xOffsetField;
|
||||
public InputField zOffsetField;
|
||||
public InputField rotationField;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
xOffsetField.onEndEdit.AddListener(delegate { OnFieldValueChanged(); });
|
||||
zOffsetField.onEndEdit.AddListener(delegate { OnFieldValueChanged(); });
|
||||
rotationField.onEndEdit.AddListener(delegate { OnFieldValueChanged(); });
|
||||
|
||||
AnimationController.Instance.animationClipTimeField.onValueChanged.AddListener(delegate { OnKeyframeValueChanged(); });
|
||||
}
|
||||
|
||||
public void OnFieldValueChanged()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe(true);
|
||||
|
||||
keyframe.GetAddonKeyframe(addonName).posX = float.Parse(xOffsetField.text);
|
||||
keyframe.GetAddonKeyframe(addonName).posZ = float.Parse(zOffsetField.text);
|
||||
keyframe.GetAddonKeyframe(addonName).rotation = float.Parse(rotationField.text);
|
||||
|
||||
clip.BuildSimpleCurves();
|
||||
Workspace.Instance.RecordEvent("Actor addon position / orientation");
|
||||
}
|
||||
|
||||
public void OnKeyframeValueChanged()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
|
||||
xOffsetField.SetTextWithoutNotify(clip.GetActorAddon(addonName).PosX.Evaluate((float)AnimationController.Instance.stageTick / Workspace.StageWindowSize).ToString());
|
||||
zOffsetField.SetTextWithoutNotify(clip.GetActorAddon(addonName).PosZ.Evaluate((float)AnimationController.Instance.stageTick / Workspace.StageWindowSize).ToString());
|
||||
rotationField.SetTextWithoutNotify(clip.GetActorAddon(addonName).Rotation.Evaluate((float)AnimationController.Instance.stageTick / Workspace.StageWindowSize).ToString());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue