Table of Contents

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

Dictionary<string, AnimationMetaData>

Triggers

public List<AnimFrameCallback> Triggers

Field Value

List<AnimFrameCallback>

api

protected ICoreAPI api

Field Value

ICoreAPI

capi

protected ICoreClientAPI capi

Field Value

ICoreClientAPI

entity

The entity attached to this Animation Manager.

protected Entity entity

Field Value

Entity

Properties

AnimationsDirty

Are the animations dirty in this AnimationManager?

public bool AnimationsDirty { get; set; }

Property Value

bool

Animator

The animator for the animation manager.

public IAnimator Animator { get; set; }

Property Value

IAnimator

HeadController

The entity head controller for this animator.

public EntityHeadController HeadController { get; set; }

Property Value

EntityHeadController

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 ITreeAttribute
version string

GetAnimationState(string)

public virtual RunningAnimation GetAnimationState(string anim)

Parameters

anim string

Returns

RunningAnimation

Init(ICoreAPI, Entity)

Initializes the Animation Manager.

public virtual void Init(ICoreAPI api, Entity entity)

Parameters

api ICoreAPI

The Core API.

entity Entity

The entity this manager is attached to.

IsAnimationActive(params string[])

public virtual bool IsAnimationActive(params string[] anims)

Parameters

anims string[]

Returns

bool

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 ICoreAPI
entity Entity
entityShape Shape
copyOverAnims RunningAnimation[]
requirePosesOnServer bool
requireJointsForElements string[]

Returns

IAnimator

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

activeAnimations int[]
activeAnimationsCount int
activeAnimationSpeeds float[]

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 string

Anim config code, not the animation code!

Returns

bool

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

bool

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 ITreeAttribute
forClient bool

TriggerAnimationStopped(string)

The event fired when the animation is stopped.

public virtual void TriggerAnimationStopped(string code)

Parameters

code string

The 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

StartAnimationDelegate

OnAnimationStopped

public event Action<string> OnAnimationStopped

Event Type

Action<string>

OnStartAnimation

public event StartAnimationDelegate OnStartAnimation

Event Type

StartAnimationDelegate