Creating a game logic class
When writing game servers, it's very common that you need some central class for processing game logic. What we have right now doesn't allow for that, so we're going to modify our ack
server to add a central class for processing game logic.
Our game class will accomplish the same thing that our ack
server already does (sends acknowledgements in response to operation requests). It will also be able to keep track of a list of peers connected to the server, and when the server shuts down it will automatically disconnect any peers that are currently connected.
using Photon.SocketServer; using PhotonHostRuntimeInterfaces; using System.Collections.Generic; public class PhotonAckGame { public static PhotonAckGame Instance; public List<PeerBase> Connections; public void Startup() { Connections = new List<PeerBase>(); } public void Shutdown() { // kick out any players still on the server before shutting down foreach...