internal static void Init(Battle _battle, Hero _hero) { int[] eventIDs = new int[_hero.sds.GetAuras().Length]; for (int i = 0; i < _hero.sds.GetAuras().Length; i++) { int auraID = _hero.sds.GetAuras()[i]; IAuraSDS auraSDS = Battle.GetAuraData(auraID); SuperEventListenerV.EventCallBack <float> dele = delegate(SuperEvent e, ref float _value) { TriggerAura(_battle, _hero, auraSDS, e, ref _value); }; eventIDs[i] = _battle.eventListenerV.AddListener(GetEventName(auraSDS.GetAuraTarget() == AuraTarget.ALLY ? _hero.isMine : !_hero.isMine, auraSDS.GetAuraEffect()), dele); } Action <SuperEvent> dieDele = delegate(SuperEvent e) { for (int i = 0; i < eventIDs.Length; i++) { _battle.eventListenerV.RemoveListener(eventIDs[i]); } _battle.eventListener.RemoveListener(e.index); }; _battle.eventListener.AddListener(HeroSkill.GetEventName(_hero.uid, SkillTime.DIE), dieDele); }
internal Hero(Battle _battle, bool _isMine, IHeroSDS _sds, int _pos, int _uid) { eventListenerV = _battle.eventListenerV; isMine = _isMine; sds = _sds; PosChange(_pos); uid = _uid; nowHp = sds.GetHp(); nowPower = sds.GetPower(); action = HeroAction.NULL; if (sds.GetSkills().Length > 0) { HeroSkill.Init(_battle, this); } if (sds.GetAuras().Length > 0) { HeroAura.Init(_battle, this); } }