Esempio n. 1
0
 bool m_PlayerHasLost( object sender, PlayerHasLostEventArgs e )
 {
     if ( PlayerHasLost != null )
     {
         playersThatHaveLost.Add( e );
         return PlayerHasLost( sender, e );
     }
     return true;
 }
Esempio n. 2
0
        bool game_PlayerHasLost( object sender, PlayerHasLostEventArgs e )
        {
            Dispatcher.BeginInvoke( new Action( () =>
            {
                if ( hv != null && sc != null )
                    sc.Move( e.Player.Head.X, e.Player.Head.Y, e.Player.Head.Z, e.Player.Color.ChangeIntensity( 0.667 ) );
                Random r = new Random();
                txtStatus.Text = GetPhrase( e.Player.PlayerInfo.PlayerName );

            } ) );

            bool matchContinues = e.Players.Where( x => x.IsAlive ).Count() > 1;

            if ( !matchContinues )
            {

                Dispatcher.BeginInvoke( new Action( () =>
                {
                    if ( this.Moves > Math.Pow( e.Match.Size / 2, 2 ) * this.PlayerList.Count )
                    {
                        txtStatus.Text = string.Format( "{0} ganhou o Lápis de Ouro!", e.Match.Players.Single( x => x.IsAlive ).PlayerInfo.PlayerName );
                    }
                    else
                    {
                        txtStatus.Text = string.Format( "NULLIFIED MATCH" );
                    }
                } ) );

                e.Match.EndMatch( this.Moves > Math.Pow( e.Match.Size / 2, 2 ) * this.PlayerList.Count );

                Dispatcher.BeginInvoke( new Action( () =>
                {
                    UpdateScore();
                    ClearCube();
                } ) );

            }
            return matchContinues;
        }