mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Improved adding and removal of anim events
This commit is contained in:
parent
f0d46df3d6
commit
8523abf957
276 changed files with 1401 additions and 5422 deletions
|
@ -17,6 +17,8 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
this.actorID = actorID;
|
||||
|
||||
Reset();
|
||||
|
||||
PawnAnimationClip clip = Workspace.Instance.GetPawnAnimationClip(actorID);
|
||||
|
||||
if (clip == null || clip.keyframes.NullOrEmpty())
|
||||
|
@ -35,22 +37,22 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
}
|
||||
|
||||
public void AddKeyFrame(int atTick)
|
||||
public void Reset()
|
||||
{
|
||||
|
||||
foreach(KeyframeSlider keyframeSlider in GetComponentsInChildren<KeyframeSlider>())
|
||||
{ Destroy(keyframeSlider.gameObject); }
|
||||
}
|
||||
|
||||
public bool CanAddKeyFrameAtTick(int atTick)
|
||||
public void AddPawnKeyFrame(int keyframeID)
|
||||
{
|
||||
foreach (Transform child in transform)
|
||||
{
|
||||
KeyframeSlider keyframeSlider = child.GetComponent<KeyframeSlider>();
|
||||
KeyframeSlider keyframeSlider = Instantiate(keyframeSliderPrefab, transform);
|
||||
keyframeSlider.Initialize(this, actorID, keyframeID);
|
||||
}
|
||||
|
||||
if (keyframeSlider != null && Workspace.Instance.GetPawnKeyframe(keyframeSlider.actorID, keyframeSlider.keyframeID).atTick == atTick)
|
||||
{ return false; }
|
||||
}
|
||||
|
||||
return true;
|
||||
public void RemovePawnKeyFrame(int keyframeID)
|
||||
{
|
||||
KeyframeSlider keyframeSlider = GetComponentsInChildren<KeyframeSlider>().FirstOrDefault(x => x.keyframeID == keyframeID);
|
||||
Destroy(keyframeSlider?.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue