feat: Play character animation when unlocking doors

This commit is contained in:
Vsevolod Kremianskii 2020-11-15 14:17:22 +07:00
parent fad3f9054e
commit b3a363edbf
3 changed files with 9 additions and 0 deletions

View file

@ -263,6 +263,7 @@ void ActionExecutor::executeOpenLock(Creature &actor, ObjectAction &action, floa
if (door) {
bool reached = navigateCreature(actor, door->position(), 1.0f, dt);
if (reached) {
actor.playUnlockDoorAnimation();
door->setLocked(false);
door->open(&actor);
if (!door->blueprint().onOpen().empty()) {

View file

@ -56,6 +56,7 @@ static string g_animRunCharacter("run");
static string g_animTalkHead("talk");
static string g_animTalkBody("tlknorm");
static string g_animGreeting("greeting");
static string g_animUnlockDoor("unlockdr");
static string g_headHookNode("headhook");
static string g_talkDummyNode("talkdummy");
@ -331,6 +332,12 @@ void Creature::playTalkAnimation() {
}
}
void Creature::playUnlockDoorAnimation() {
if (!_model) return;
_model->playAnimation(g_animUnlockDoor, kAnimationBlend);
}
void Creature::equip(const string &resRef) {
shared_ptr<ItemBlueprint> blueprint(Blueprints::instance().getItem(resRef));

View file

@ -74,6 +74,7 @@ public:
void playDefaultAnimation();
void playGreetingAnimation();
void playTalkAnimation();
void playUnlockDoorAnimation();
// END Animations