mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Xml;
|
|
using System.Xml.Serialization;
|
|
using UnityEngine;
|
|
|
|
namespace RimWorldAnimationStudio
|
|
{
|
|
public class PawnKeyframe : Keyframe
|
|
{
|
|
public float bodyAngle;
|
|
public float headAngle;
|
|
public float headBob;
|
|
public float bodyOffsetX;
|
|
public float bodyOffsetZ;
|
|
public float headFacing;
|
|
public float bodyFacing;
|
|
|
|
public float? genitalAngle;
|
|
public bool? quiver;
|
|
|
|
public bool ShouldSerializegenitalAngle() { return genitalAngle != null; }
|
|
public bool ShouldSerializequiver() { return quiver != null; }
|
|
|
|
[XmlIgnore] public int keyframeID;
|
|
|
|
public void GenerateKeyframeID()
|
|
{
|
|
int _keyframeID = Random.Range(100000, 1000000);
|
|
|
|
if (Workspace.animationDef.animationStages.Any(x => x.animationClips.Any(y => y.keyframes.Any(z => z.keyframeID == _keyframeID))))
|
|
{
|
|
GenerateKeyframeID();
|
|
return;
|
|
}
|
|
|
|
keyframeID = _keyframeID;
|
|
}
|
|
|
|
public bool HasValidKeyframeID()
|
|
{ return keyframeID >= 100000 && keyframeID < 1000000; }
|
|
}
|
|
}
|