コード例 #1
0
ファイル: Participant.cs プロジェクト: HerbFargus/bomberstuff
 /// <summary>
 ///
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnPlayerAction(PlayerActionEventArgs e)
 {
     if (PlayerAction != null)
     {
         PlayerAction(this, e);
     }
 }
コード例 #2
0
ファイル: Game.cs プロジェクト: HerbFargus/bomberstuff
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Participant_PlayerAction(object sender, PlayerActionEventArgs e)
        {
            Participant p = (Participant)sender;

            // action 1: place bomb
            if (e.Type == PlayerActionEventArgs.Types.Action1)
            {
                if (p.HasAuthority || p.ControlsPlayer(e.PlayerIndex))
                {
                    Players[e.PlayerIndex].PlaceBomb(Board);
                }
                else
                {
                    System.Diagnostics.Debug.Assert(false, "Unauthorized Participant trying to control Player" + e.PlayerIndex);
                }
            }
        }