void BattleEntity::OnStatusChange(EntityStatus oldStatus, EntityStatus newStatus)
{
	const char *pAnimName = m_vecAnimation[newStatus].c_str();
    switch (newStatus)
    {
        case ES_IDLE:
        {
            Play(pAnimName);
        }
        break;
        case ES_RUN:
        {
            Play(pAnimName);
        }
        break;
        case ES_ATTACK1:
        {
            Play(pAnimName, false, [this](){SetEntityStatus(ES_IDLE);});
        }
        break;
        case ES_ATTACK2:
        {
            Play(pAnimName, false, [this](){SetEntityStatus(ES_IDLE); });
        }
        break;
        case ES_SKILL1:
        {
            Play(pAnimName, false, [this](){SetEntityStatus(ES_IDLE); });
        }
        break;
        case ES_SKILL2:
        {
            Play(pAnimName, false, [this](){SetEntityStatus(ES_IDLE); });
        }
        break;
        case ES_HURT:
        {
            Play(pAnimName, false, [this](){SetEntityStatus(ES_IDLE); });
        }
        break;
        case ES_DEAD:
        {
            Play(pAnimName, false, [this](){ OnDead();});
        }
        break;
        case ES_WIN:
        {
            Play(pAnimName);
        }
        break;
        case ES_FALIURE:
        {
            Play(pAnimName);
        }
        break;
    }
}
示例#2
0
    void PetAI::OnEvent(const AIEvent &event)
    {
        switch(event.Type())
        {
        case ET_HURT:
            OnHurt();
            break;

        case ET_KILL:
            OnDead();
            break;

        case ET_USESKILLEND:
            {
                const UseSkillEndEvent &uev = (const UseSkillEndEvent&) event;
                OnSkillEnd(uev.type);
            }
            break;
        }
    }