in Samples~/SampleGame/Assets/Scripts/GameLogic.cs [95:141]
private async void Start()
{
_logger.Write(":) GAMELOGIC START");
// create owned objects
Log = new GameLog(this, _logger);
_input = new Input(this);
Status = new Status(this);
_simulation = new Simulation(this);
Render = new Render();
#if UNITY_SERVER
_server = new NetworkServer(this, GameLift.ServerPort);
// if running server, GameLift is already initialized before GameLogic.Start is called
GameliftStatus = GameLift.IsConnected;
_logger.Write(":) LISTENING ON PORT " + GameLift.ServerPort);
#else
_client = new NetworkClient(this);
_connectionCancellationTokenSource = new CancellationTokenSource();
if (GameLift == null)
{
return;
}
try
{
await Connect(_connectionCancellationTokenSource.Token);
}
catch (TaskCanceledException)
{
Log.WriteLine("Connection was cancelled.");
return;
}
#endif
// Start Game
_input.Start();
Status.Start();
_simulation.ResetBoard();
_simulation.ResetScores();
#if UNITY_SERVER
// if I am the server, I will send my state to all the clients so they have the same board and RNG state as I do
_server.TransmitState();
#endif
Log.WriteLine("HELLO WORLD!");
Render.SetMessage("HELLO WORLD!");
ResetMessage(60);
RenderBoard();
}