2020-12-08 17:36:20 +01:00
|
|
|
|
using Unity.Entities;
|
|
|
|
|
using Unity.Collections;
|
|
|
|
|
|
|
|
|
|
namespace TAO.VertexAnimation
|
|
|
|
|
{
|
|
|
|
|
[System.Serializable]
|
|
|
|
|
public struct VA_AnimationData
|
|
|
|
|
{
|
2020-12-09 18:36:32 +01:00
|
|
|
|
public FixedString32 name;
|
2020-12-08 17:36:20 +01:00
|
|
|
|
public int frames;
|
|
|
|
|
public int maxFrames;
|
2020-12-09 18:36:32 +01:00
|
|
|
|
// 1.0f / maxFrames.
|
|
|
|
|
public float frameTime;
|
|
|
|
|
// frameTime * frames.
|
|
|
|
|
public float duration;
|
2020-12-08 17:36:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-12-09 18:36:32 +01:00
|
|
|
|
public struct VA_AnimationLibrary
|
2020-12-08 17:36:20 +01:00
|
|
|
|
{
|
|
|
|
|
public BlobArray<VA_AnimationData> animations;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-09 18:36:32 +01:00
|
|
|
|
public static class VA_AnimationLibraryUtils
|
2020-12-08 17:36:20 +01:00
|
|
|
|
{
|
2020-12-09 18:36:32 +01:00
|
|
|
|
public static int GetAnimation(ref VA_AnimationLibrary animationsRef, FixedString32 animationName)
|
2020-12-08 17:36:20 +01:00
|
|
|
|
{
|
2020-12-09 18:36:32 +01:00
|
|
|
|
for (int i = 0; i < animationsRef.animations.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (animationsRef.animations[i].name == animationName)
|
|
|
|
|
{
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-08 17:36:20 +01:00
|
|
|
|
|
2020-12-09 18:36:32 +01:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
2020-12-08 17:36:20 +01:00
|
|
|
|
}
|
|
|
|
|
}
|