Example #1
0
        /// <summary>
        ///     死亡时
        /// </summary>
        /// <param name="_this"></param>
        /// <param name="characterId"></param>
        /// <param name="delayView"></param>
        /// <param name="damage"></param>
        public void OnDie(AutoPlayer _this, ulong characterId, int delayView, int damage = 0)
        {
            var replyMsg = new BuffResultMsg();

            replyMsg.buff.Add(new BuffResult
            {
                TargetObjId = _this.ObjId,
                Type        = BuffType.HT_DIE,
                ViewTime    = Extension.AddTimeDiffToNet(delayView)
            });
            _this.BroadcastBuffList(replyMsg);
            _this.Skill.StopCurrentSkill();
            _this.RemoveMeFromOtherEnemyList();
            _this.ClearEnemy();

            //Drop.MonsterKill(this, characterId);
            try
            {
                _this.Scene.OnNpcDie(_this, characterId);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
            _this.EnterState(BehaviorState.Die);
            //mTrigger = SceneServerControl.Timer.CreateTrigger(DateTime.Now.AddMilliseconds(TableNpc.CorpseTime), Disapeare);

            try
            {
                _this.Script.OnDie(_this, characterId, delayView, damage);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }