Exemplo n.º 1
0
    public void AddPlayer(Player p)
    {
        if (!isReady)
        {
            if (p1 == null)
            {
                UIConsoleManager.WriteLineInGreen("Player 1 -> {0} has joined Game {1}", p.endPoint.ToString(), index);
                p1 = p;
            }
            else if (p2 == null && p.clientID != p1.clientID)
            {
                UIConsoleManager.WriteLineInGreen("Player 2 -> {0} has joined Game {1}", p.endPoint.ToString(), index);
                p2 = p;
            }

            if (p1 != null && p2 != null)
            {
                UIConsoleManager.WriteLineInCyan("\n>>Game {0}: started running", index);
                isReady = true;
            }
        }
    }