VertexAnimation/Runtime/Scripts/VA_AnimationLibraryData.cs
max e4ca15301b AnimationLibrary Editor
AnimationLibraryBook editor setup.
AnimationLibrary texture2DArray generation and material setup.
2020-12-10 19:51:02 +01:00

38 lines
839 B
C#

using Unity.Entities;
using Unity.Collections;
namespace TAO.VertexAnimation
{
[System.Serializable]
public struct VA_AnimationData
{
public FixedString32 name;
public int frames;
public int maxFrames;
// 1.0f / maxFrames.
public float frameTime;
// frameTime * frames.
public float duration;
}
public struct VA_AnimationLibraryData
{
public BlobArray<VA_AnimationData> animations;
}
public static class VA_AnimationLibraryUtils
{
public static int GetAnimation(ref VA_AnimationLibraryData animationsRef, FixedString32 animationName)
{
for (int i = 0; i < animationsRef.animations.Length; i++)
{
if (animationsRef.animations[i].name == animationName)
{
return i;
}
}
return -1;
}
}
}