/// <summary> /// 动作剪辑播放完成回调函数 /// </summary> /// <param name="obj"></param> private void OnPlayingClipOK(string clip) { switch (clip) { case AnimNames.Attack: //战斗完成 case AnimNames.Skill: OnNpcSkillAttackOK(clip); PlayRoleAnim(AnimNames.Idle, true); break; case AnimNames.Damage: //被击完成 if (!bRunning) { PlayRoleAnim(AnimNames.Idle, true); } break; } GLogger.White("OnPlayingClipOK::>>" + clip); }
/// <summary> /// 受到伤害 /// </summary> private void OnNpcSkillAttack(GameEventData evData) { var evBattle = evData.evParam as NpcSkillAttackEvent; if (evBattle != null) { var eventid = evData.eventId; var attackerid = evBattle.attackerid; var defenderid = evBattle.defenderid; var attacker = npcMgr.GetNpc(attackerid) as RoleView; var defender = npcMgr.GetNpc(defenderid) as RoleView; if (attacker != null && defender != null) { GLogger.White("OnAttackNpc:>>eventid:" + eventid + " attacker:" + attackerid + " defender:" + defenderid + " currhp:" + evBattle.currHp + " maxhp:" + evBattle.maxHp); attacker.NpcSkillAttack(defender, evBattle, delegate() { Messenger.Broadcast <long>(EventNames.EvNpcSkillAttackOK, eventid); }); } } }