Class AnimationManager
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
public class AnimationManager : IAnimationManager, IDisposable
- Inheritance
-
AnimationManager
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
AnimationManager()
public AnimationManager()
Fields
ActiveAnimationsByAnimCode
The list of currently active animations that should be playing
public Dictionary<string, AnimationMetaData> ActiveAnimationsByAnimCode
Field Value
Triggers
public List<AnimFrameCallback> Triggers
Field Value
api
protected ICoreAPI api
Field Value
capi
protected ICoreClientAPI capi
Field Value
entity
The entity attached to this Animation Manager.
protected Entity entity
Field Value
Properties
AdjustCollisionBoxToAnimation
public bool AdjustCollisionBoxToAnimation { get; set; }
Property Value
AnimationsDirty
Are the animations dirty in this AnimationManager?
public bool AnimationsDirty { get; set; }
Property Value
Animator
The animator for the animation manager.
public IAnimator Animator { get; set; }
Property Value
HeadController
The entity head controller for this animator.
public EntityHeadController HeadController { get; set; }
Property Value
Methods
CopyOverAnimStates(RunningAnimation[], IAnimator)
public void CopyOverAnimStates(RunningAnimation[] copyOverAnims, IAnimator animator)
Parameters
copyOverAnimsRunningAnimation[]animatorIAnimator
Dispose()
Disposes of the animation manager.
public void Dispose()
FromAttributes(ITreeAttribute, string)
Loads the entity from a stored byte array from the SaveGame
public virtual void FromAttributes(ITreeAttribute tree, string version)
Parameters
treeITreeAttributeversionstring
GetAnimationState(string)
public virtual RunningAnimation GetAnimationState(string anim)
Parameters
animstring
Returns
Init(ICoreAPI, Entity)
Initializes the Animation Manager.
public virtual void Init(ICoreAPI api, Entity entity)
Parameters
IsAnimationActive(params string[])
public virtual bool IsAnimationActive(params string[] anims)
Parameters
animsstring[]
Returns
LoadAnimator(ICoreAPI, Entity, Shape, RunningAnimation[], bool, params string[])
public IAnimator LoadAnimator(ICoreAPI api, Entity entity, Shape entityShape, RunningAnimation[] copyOverAnims, bool requirePosesOnServer, params string[] requireJointsForElements)
Parameters
apiICoreAPIentityEntityentityShapeShapecopyOverAnimsRunningAnimation[]requirePosesOnServerboolrequireJointsForElementsstring[]
Returns
OnClientFrame(float)
The event fired each time the client ticks.
public virtual void OnClientFrame(float dt)
Parameters
dtfloat
OnReceivedServerAnimations(int[], int, float[])
The event fired when the manager recieves the server animations.
public virtual void OnReceivedServerAnimations(int[] activeAnimations, int activeAnimationsCount, float[] activeAnimationSpeeds)
Parameters
OnServerTick(float)
The event fired at each server tick.
public virtual void OnServerTick(float dt)
Parameters
dtfloat
RegisterFrameCallback(AnimFrameCallback)
public virtual void RegisterFrameCallback(AnimFrameCallback trigger)
Parameters
triggerAnimFrameCallback
ResetAnimation(string)
If given animation is running, will set its progress to the first animation frame
public virtual void ResetAnimation(string animCode)
Parameters
animCodestring
SerializeActiveAnimations(bool, Action<string, FastMemoryStream>)
protected virtual void SerializeActiveAnimations(bool forClient, Action<string, FastMemoryStream> output)
Parameters
forClientbooloutputAction<string, FastMemoryStream>
ShouldPlaySound(AnimationSound)
public void ShouldPlaySound(AnimationSound sound)
Parameters
soundAnimationSound
StartAnimation(string)
Start a new animation defined in the entity config file. If it's not defined, it won't play. Use StartAnimation(AnimationMetaData animdata) to circumvent the entity config anim data.
public virtual bool StartAnimation(string configCode)
Parameters
configCodestringAnim config code, not the animation code!
Returns
StartAnimation(AnimationMetaData)
Client: Starts given animation Server: Sends all active anims to all connected clients then purges the ActiveAnimationsByAnimCode list
public virtual bool StartAnimation(AnimationMetaData animdata)
Parameters
animdataAnimationMetaData
Returns
StopAllAnimations()
Stops all currently playing animations
public virtual void StopAllAnimations()
StopAnimation(string)
Stops given animation
public virtual void StopAnimation(string code)
Parameters
codestring
ToAttributeBytes(BinaryWriter, bool)
For performance, serializes the animations to be stored directly to the provided stream
public virtual void ToAttributeBytes(BinaryWriter stream, bool forClient)
Parameters
streamBinaryWriterforClientbool
ToAttributes(ITreeAttribute, bool)
Serializes the animations to be stored in the SaveGame
public virtual void ToAttributes(ITreeAttribute tree, bool forClient)
Parameters
treeITreeAttributeforClientbool
TriggerAnimationStopped(string)
The event fired when the animation is stopped.
public virtual void TriggerAnimationStopped(string code)
Parameters
codestringThe code that the animation stopped with.
TryStartAnimation(AnimationMetaData)
As StartAnimation, except that it does not attempt to start the animation if the named animation is non-existent for this entity
public virtual bool TryStartAnimation(AnimationMetaData animdata)
Parameters
animdataAnimationMetaData
Returns
onReceivedServerAnimation(AnimationMetaData)
protected virtual void onReceivedServerAnimation(AnimationMetaData animmetadata)
Parameters
animmetadataAnimationMetaData
Events
OnAnimationReceived
public event StartAnimationDelegate OnAnimationReceived
Event Type
OnAnimationStopped
public event Action<string> OnAnimationStopped
Event Type
OnStartAnimation
public event StartAnimationDelegate OnStartAnimation