/// <summary> /// 添加角色(带事件注册) /// </summary> /// <param name="role">角色对象</param> /// <param name="e">需注册的事件参数</param> public void AddRole(RoleBase role, RoleAddedEventArgs e) { AddRole(role); if (RoleAdded != null) { RoleAdded(role, e); } }
/// <summary> /// 角色添加时 /// </summary> void space_RoleAdded(object sender, RoleAddedEventArgs e) { RoleBase role = sender as RoleBase; if (e.RegisterDisposedEvent) { role.Disposed += role_Disposed; role.ActionTrigger += role_ShadowSync; } if (e.RegisterIntervalTriggerEvent) { role.IntervalTrigger += role_TacticDecide; } if (e.RegisterActionTriggerEvent) { role.ActionTrigger += role_ActionDecide; } if (e.RegisterDoAttackEvent) { role.DoAttack += role_DoAttack; } if (e.RegisterDoCastingEvent) { role.DoCasting += role_DoCasting; } if (e.RegisterPositionChangedEvent) { role.PositionChanged += role_PositionChanged; } if (e.RegisterLifeChangedEvent) { role.LifeChanged += role_LifeChanged; role.LifeChanged += TargetInfo_LifeChanged; role.LifeMaxChanged += TargetInfo_LifeChanged; } }