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
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
copyOverAnims
RunningAnimation[]animator
IAnimator
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
tree
ITreeAttributeversion
string
GetAnimationState(string)
public virtual RunningAnimation GetAnimationState(string anim)
Parameters
anim
string
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
anims
string[]
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
api
ICoreAPIentity
EntityentityShape
ShapecopyOverAnims
RunningAnimation[]requirePosesOnServer
boolrequireJointsForElements
string[]
Returns
OnClientFrame(float)
The event fired each time the client ticks.
public virtual void OnClientFrame(float dt)
Parameters
dt
float
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
dt
float
RegisterFrameCallback(AnimFrameCallback)
public virtual void RegisterFrameCallback(AnimFrameCallback trigger)
Parameters
trigger
AnimFrameCallback
ResetAnimation(string)
If given animation is running, will set its progress to the first animation frame
public virtual void ResetAnimation(string animCode)
Parameters
animCode
string
ShouldPlaySound(AnimationSound)
public void ShouldPlaySound(AnimationSound sound)
Parameters
sound
AnimationSound
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
configCode
stringAnim 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
animdata
AnimationMetaData
Returns
StopAnimation(string)
Stops given animation
public virtual void StopAnimation(string code)
Parameters
code
string
ToAttributes(ITreeAttribute, bool)
Serializes the slots contents to be stored in the SaveGame
public virtual void ToAttributes(ITreeAttribute tree, bool forClient)
Parameters
tree
ITreeAttributeforClient
bool
TriggerAnimationStopped(string)
The event fired when the animation is stopped.
public virtual void TriggerAnimationStopped(string code)
Parameters
code
stringThe code that the animation stopped with.
onReceivedServerAnimation(AnimationMetaData)
protected virtual void onReceivedServerAnimation(AnimationMetaData animmetadata)
Parameters
animmetadata
AnimationMetaData
Events
OnAnimationReceived
public event StartAnimationDelegate OnAnimationReceived
Event Type
OnAnimationStopped
public event Action<string> OnAnimationStopped
Event Type
OnStartAnimation
public event StartAnimationDelegate OnStartAnimation