/// <summary> /// </summary> /// <param name="character"> /// </param> /// <param name="messageDataFiller"> /// </param> /// <returns> /// </returns> /// <exception cref="NotImplementedException"> /// </exception> protected override T Create(ICharacter character, MessageDataFiller messageDataFiller) { T temp = new T(); messageDataFiller(temp); return(temp); }
/// <summary> /// </summary> /// <param name="character"> /// </param> /// <param name="messageDataFiller"> /// </param> /// <param name="announceToPlayfield"> /// </param> /// <exception cref="NotImplementedException"> /// </exception> protected override void Send( ICharacter character, MessageDataFiller messageDataFiller, bool announceToPlayfield = false) { if ((this.Direction == MessageHandlerDirection.All) || (this.Direction == MessageHandlerDirection.OutboundOnly)) { T mb = this.Create(character, messageDataFiller); character.Send(mb, announceToPlayfield); } else { throw new NotImplementedException("This message handler cannot send outboud messages"); } }
/// <summary> /// </summary> /// <param name="character"> /// </param> /// <param name="messageDataFiller"> /// </param> /// <param name="announceToPlayfield"> /// </param> /// <exception cref="NotImplementedException"> /// </exception> protected void SendToPlayfield(ICharacter character, MessageDataFiller messageDataFiller) { this.Send(character, messageDataFiller, true); }
/// <summary> /// </summary> /// <param name="character"> /// </param> /// <param name="messageDataFiller"> /// </param> /// <param name="announceToPlayfield"> /// </param> protected abstract void Send( ICharacter character, MessageDataFiller messageDataFiller, bool announceToPlayfield = false);
/// <summary> /// </summary> /// <param name="character"> /// </param> /// <param name="messageDataFiller"> /// </param> /// <returns> /// </returns> protected abstract T Create(ICharacter character, MessageDataFiller messageDataFiller);