rimworld-animation-studio/Assets/Scripts/AnimationComponents/KeyFrames/PawnKeyframe.cs
2022-09-16 17:50:15 -05:00

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; }
}
}