//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using System;
using System.Runtime.CompilerServices;
namespace BansheeEngine
{
/** @addtogroup Animation
* @{
*/
///
/// Contains animation curves for translation/rotation/scale of scene object/skeleton bones, as well as curves for
/// generic property animation.
///
public class AnimationClip : Resource
{
///
/// Returns the length of the animation clip, in seconds.
///
public float Length
{
get { return Internal_GetLength(mCachedPtr); }
}
///
/// A set of all curves stored in the animation clip.
///
public AnimationCurves Curves
{
get { return Internal_GetAnimationCurves(mCachedPtr); }
set { Internal_SetAnimationCurves(mCachedPtr, value); }
}
///
/// A set of all events stored in the animation clip.
///
public AnimationEvent[] Events
{
get { return Internal_GetAnimationEvents(mCachedPtr); }
set { Internal_SetAnimationEvents(mCachedPtr, value); }
}
///
/// Constructor for internal use by the runtime.
///
private AnimationClip()
{ }
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern AnimationCurves Internal_GetAnimationCurves(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_SetAnimationCurves(IntPtr thisPtr, AnimationCurves curves);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern AnimationEvent[] Internal_GetAnimationEvents(IntPtr thisPtr);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Internal_SetAnimationEvents(IntPtr thisPtr, AnimationEvent[] events);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern float Internal_GetLength(IntPtr thisPtr);
}
///
/// Event that is triggered when animation reaches a certain point.
///
public class AnimationEvent
{
///
/// Constructs a new animation event.
///
/// Name used to identify the event when it is triggered.
/// Time at which to trigger the event, in seconds.
public AnimationEvent(string name, float time)
{
Name = name;
Time = time;
}
///
/// Name used to identify the event when it is triggered.
///
public string Name;
///
/// Time at which to trigger the event, in seconds.
///
public float Time;
}
/** @} */
}