// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2023 Kybernetik //
using UnityEngine.Animations;
using Unity.Collections;
namespace Animancer
{
/// [Pro-Only]
/// A wrapper which allows access to the value of properties that are controlled by animations.
///
///
/// Documentation: Animated Properties
///
/// Animation Jobs
/// https://kybernetik.com.au/animancer/api/Animancer/AnimatedInt
///
public class AnimatedInt : AnimatedProperty
{
/************************************************************************************************************************/
///
/// Allocates room for a specified number of properties to be filled by
/// .
///
public AnimatedInt(IAnimancerComponent animancer, int propertyCount,
NativeArrayOptions options = NativeArrayOptions.ClearMemory)
: base(animancer, propertyCount, options)
{ }
/// Initializes a single property.
public AnimatedInt(IAnimancerComponent animancer, string propertyName)
: base(animancer, propertyName)
{ }
/// Initializes a group of properties.
public AnimatedInt(IAnimancerComponent animancer, params string[] propertyNames)
: base(animancer, propertyNames)
{ }
/************************************************************************************************************************/
protected override void CreateJob()
{
_Job = new Job() { properties = _Properties, values = _Values };
}
/************************************************************************************************************************/
/// An which reads an array of values.
/// https://kybernetik.com.au/animancer/api/Animancer/Job
///
public struct Job : IAnimationJob
{
public NativeArray properties;
public NativeArray values;
public void ProcessRootMotion(AnimationStream stream) { }
public void ProcessAnimation(AnimationStream stream)
{
for (int i = properties.Length - 1; i >= 0; i--)
values[i] = properties[i].GetInt(stream);
}
}
/************************************************************************************************************************/
}
}