public GameLogic(Player one, Player two, Player three, Player four) { first = one; second = two; third = three; fourth = four; fourPlayer = true; setDefaultPosition(1); setDefaultPosition(2); setDefaultPosition(3); setDefaultPosition(4); gameHasStarted = false; timerStarted = false; }
public void addNewGame(Player one, Player two, Player three, Player four) { }
public bool joinSession(string SessionToJoin, Player joiningPlayer) { mutexLock.WaitOne(); try { if(SessionToJoin == "") { if (gameSessions.ContainsKey(genericSession)) { if (gameSessions[genericSession].addPlayerToGame(joiningPlayer)) { playerSessionNames.Add(joiningPlayer.IP, SessionToJoin); return true; } else return false; } else { creatNewSession(genericSession); gameSessions[genericSession].setSessionName(genericSession); gameSessions[genericSession].addPlayerToGame(joiningPlayer); playerSessionNames.Add(joiningPlayer.IP, genericSession); return true; } } else if (gameSessions.ContainsKey(SessionToJoin)) { if (gameSessions[SessionToJoin].addPlayerToGame(joiningPlayer)) { playerSessionNames.Add(joiningPlayer.IP, SessionToJoin); return true; } else return false; } else { creatNewSession(SessionToJoin); gameSessions[SessionToJoin].setSessionName(SessionToJoin); gameSessions[SessionToJoin].addPlayerToGame(joiningPlayer); playerSessionNames.Add(joiningPlayer.IP, SessionToJoin); return true; } } finally { mutexLock.ReleaseMutex(); } }
public GameLogic(Player one, Player two) { first = one; second = two; fourPlayer = false; setDefaultPosition(1); setDefaultPosition(2); setDefaultPosition(3); setDefaultPosition(4); gameHasStarted = false; timerStarted = false; }
public bool addPlayerToGame(Player toAdd) { if (playerCount != 4) { if (playerCount == 0) first = toAdd; else if (playerCount == 1) second = toAdd; else if (playerCount == 2) third = toAdd; else if (playerCount == 3) fourth = toAdd; if (playerCount <= 3) playerCount++; return true; } else return false; }