/// <summary> /// Initializes client and automatically joins a multiplayer game. /// </summary> public void InitMultiplayerClient() { InitCommon(); Client c = networkOperator.JoinGame(ref gameState); gameExecutor = new MultiplayerClientCommandsExecutor(gameState, c); gameExecutor.Execute(new JoinGameCommand(false, PlayerType.HUMAN, "GuestPlayer")); Debug.Log("Inited multiplayer client"); }
/// <summary> /// Creates server for a multiplayer game. /// </summary> public void InitMultiplayerServer() { InitCommon(); Server s = networkOperator.RunServer(); gameExecutor = new MultiplayerServerCommandsExecutor(gameState, s); gameExecutor.Execute(new JoinGameCommand(true, PlayerType.HUMAN, "ServerMaster")); Debug.Log("Inited multiplayer server"); }
/// <summary> /// Creates one-player server for a singleplayer. /// </summary> public void InitSingleplayer() { gameState = new GameState(); networkOperator.maxPlayers = 0; Server s = networkOperator.RunServer(); gameExecutor = new MultiplayerServerCommandsExecutor(gameState, s); gameExecutor.Execute(new JoinGameCommand(true, PlayerType.HUMAN, "LocalPlayer")); Debug.Log("Inited singleplayer"); }
public void WorldTick() { executor.Execute(new AddPointsCommand(1)); }