public void AddExp(long exp) { Attr.Exp += exp; ResExp data = mExpDataList.Find(e => e.max >= Attr.Exp && e.min <= Attr.Exp); if (data != null && data.level > Attr.Level) { SetLevel(data); EventDispatcher.Broadcast(EventNames.LevelUp, this); } }
protected void SetLevel(ResExp data) { if (data != null) { Attr.Clear(); Attr.MoveSpeed = Data.speed; Attr.Level = data.level; Attr.HpLmt = data.hp_lmt; Attr.Defence = data.defence; Attr.Atk = data.attack; if (CurSkill != null) { Attr.Add(CurSkill.Attr); } Attr.Hp = Attr.HpLmt; } }