Example #1
0
        private void OnNpcAttrChangedEvent(NpcAttrChangedEvent Event)
        {
            if (Event.Master.ID != ID)
            {
                return;
            }

            switch (Event.Index)
            {
            case NpcAttrIndex.MaxHp:
                Bar_.SetMaxHp(CalcFinalAttr(NpcAttrIndex.MaxHp));
                break;

            case NpcAttrIndex.MaxMp:
                Bar_.SetMaxMp(CalcFinalAttr(NpcAttrIndex.MaxMp));
                break;

            case NpcAttrIndex.Speed:
                Action.MoveTo(Action.TargetPos);
                break;

            case NpcAttrIndex.Hp:
                if (Event.ChangeValue < 0)
                {
                    LabelManager.AddNumberLabel(Position, NumberLabelType.Float, Event.ChangeValue);
                }

                if (CalcFinalAttr(NpcAttrIndex.Hp) <= 0)
                {
                    Dead();
                }
                break;

            default:
                break;
            }
        }