Example #1
0
        public void GameOver()
        {
            lost = true;
            left = 8;
            top  = 40;
            ClientInterface c = (ClientInterface)Activator.GetObject(
                typeof(ClientInterface),
                this.getUrl());

            c.gameOver();
        }
Example #2
0
        //we don't check ties
        private void calculateWinner()
        {
            int maxCoins = 0;
            int playerId = 0;

            for (int i = 0; i < players.Count; i++)
            {
                Player p = players[i];
                if (p.score > maxCoins)
                {
                    maxCoins = p.score;
                    playerId = p.getId();
                }
            }

            try
            {
                ClientInterface c = (ClientInterface)Activator.GetObject(typeof(ClientInterface), players[playerId].getUrl());
                c.gameWon();
            }
            catch (Exception e)
            {
                Console.WriteLine("ERRO6");
                failureDetector.getKnownProcessById(playerId.ToString()).addFail(new Fail());
                players[playerId].setAlive(false);
            }

            for (int i = 0; i < players.Count && players[i].getId() != playerId; i++)
            {
                try
                {
                    ClientInterface c = (ClientInterface)Activator.GetObject(typeof(ClientInterface), players[i].getUrl());
                    c.gameOver();
                }
                catch (Exception e)
                {
                    Console.WriteLine("ERRO7");
                    failureDetector.getKnownProcessById(i.ToString()).addFail(new Fail());
                    players[i].setAlive(false);
                }
            }
        }