Add a GetAnimationName getter function for the VisualActor component, so that the simulation can not only set an animation but also find out which one is currently being played.

Differential Revision: https://code.wildfiregames.com/D219
Reviewed By: bb
This was SVN commit r19299.
This commit is contained in:
elexis 2017-03-15 14:27:51 +00:00
parent fd22da55ce
commit c288a91c6d
3 changed files with 11 additions and 0 deletions

View File

@ -421,6 +421,11 @@ public:
m_Unit->SetEntitySelection(key, selection);
}
virtual std::string GetAnimationName()
{
return m_AnimName;
}
virtual void SelectAnimation(const std::string& name, bool once, fixed speed, const std::wstring& soundgroup)
{
m_AnimRunThreshold = fixed::Zero();

View File

@ -23,6 +23,7 @@
BEGIN_INTERFACE_WRAPPER(Visual)
DEFINE_INTERFACE_METHOD_2("SetVariant", void, ICmpVisual, SetVariant, CStr, CStr)
DEFINE_INTERFACE_METHOD_0("GetAnimationName", std::string, ICmpVisual, GetAnimationName)
DEFINE_INTERFACE_METHOD_4("SelectAnimation", void, ICmpVisual, SelectAnimation, std::string, bool, fixed, std::wstring)
DEFINE_INTERFACE_METHOD_1("SelectMovementAnimation", void, ICmpVisual, SelectMovementAnimation, fixed)
DEFINE_INTERFACE_METHOD_1("ResetMoveAnimation", void, ICmpVisual, ResetMoveAnimation, std::string)

View File

@ -86,6 +86,11 @@ public:
*/
virtual void SetVariant(const CStr& key, const CStr& selection) = 0;
/**
* Returns the name of the currently played animation.
*/
virtual std::string GetAnimationName() = 0;
/**
* Start playing the given animation. If there are multiple possible animations then it will
* pick one at random (not network-synchronised).