// Called when the Play button is pressed in Unity. public void Start() { Configuration.Networking.LinkProtocol = NetworkConnectionType.Tcp; Configuration.Networking.TcpMultiplexLevel = 1; SpatialOS.ApplyConfiguration(Configuration); Time.fixedDeltaTime = 1.0f / SimulationSettings.FixedFramerate; // Distinguishes between when the Unity is running as a client or a server. switch (SpatialOS.Configuration.WorkerPlatform) { case WorkerPlatform.UnityWorker: Application.targetFrameRate = SimulationSettings.TargetServerFramerate; SpatialOS.OnDisconnected += reason => Application.Quit(); SpatialOS.Connect(gameObject); break; case WorkerPlatform.UnityClient: Application.targetFrameRate = SimulationSettings.TargetClientFramerate; SpatialOS.OnConnected += CreatePlayer; SceneManager.LoadSceneAsync(BuildSettings.SplashScreenScene, LoadSceneMode.Additive); break; } // Enable communication with the SpatialOS layer of the simulation. SpatialOS.Connect(gameObject); }
private void Start() { List <string> assetsToPreCache = new List <string> { SimulationSettings.PlayerPrefabName, SimulationSettings.NPCPrefabName, SimulationSettings.NPCWizardPrefabName, SimulationSettings.HQPrefabName, SimulationSettings.TreePrefabName, SimulationSettings.BarracksPrefabName, SimulationSettings.PlayerSpawnerPrefabName }; SpatialOS.AssetsToPrecache = assetsToPreCache; SpatialOS.ApplyConfiguration(Configuration); Time.fixedDeltaTime = 1.0f / SimulationSettings.FixedFramerate; switch (SpatialOS.Configuration.WorkerPlatform) { case WorkerPlatform.UnityWorker: Application.targetFrameRate = SimulationSettings.TargetFramerateUnityWorker; SpatialOS.OnDisconnected += reason => Application.Quit(); SpatialOS.Connect(gameObject); break; case WorkerPlatform.UnityClient: SceneManager.LoadScene(SimulationSettings.SplashScreenScene, LoadSceneMode.Additive); Application.targetFrameRate = SimulationSettings.TargetFramerate; SpatialOS.OnConnected += ClientPlayerSpawner.SpawnPlayer; break; } }
private void Start() { SpatialOS.ApplyConfiguration(Configuration); Application.targetFrameRate = SimulationSettings.TargetFramerate; Time.fixedDeltaTime = 1.0f / SimulationSettings.FixedFramerate; switch (SpatialOS.Configuration.EnginePlatform) { case EnginePlatform.FSim: SpatialOS.OnDisconnected += reason => Application.Quit(); break; case EnginePlatform.Client: SpatialOS.OnConnected += ClientPlayerSpawner.SpawnPlayer; break; } SpatialOS.Connect(gameObject); }
public void Start() { SpatialOS.ApplyConfiguration(Configuration); Time.fixedDeltaTime = 1.0f / SimulationSettings.FixedFramerate; switch (SpatialOS.Configuration.WorkerPlatform) { case WorkerPlatform.UnityWorker: Application.targetFrameRate = SimulationSettings.TargetServerFramerate; SpatialOS.OnDisconnected += reason => Application.Quit(); SpatialOS.Connect(gameObject); break; case WorkerPlatform.UnityClient: Application.targetFrameRate = SimulationSettings.TargetClientFramerate; SpatialOS.OnConnected += CreatePlayer; break; } }
// Called when the Play button is pressed in Unity. // public void Start() // { // SpatialOS.ApplyConfiguration(Configuration); // // Time.fixedDeltaTime = 1.0f / SimulationSettings.FixedFramerate; // // // Distinguishes between when the Unity is running as a client or a server. // switch (SpatialOS.Configuration.WorkerPlatform) // { // case WorkerPlatform.UnityWorker: // Application.targetFrameRate = SimulationSettings.TargetServerFramerate; // SpatialOS.OnDisconnected += reason => Application.Quit(); // break; // case WorkerPlatform.UnityClient: // Application.targetFrameRate = SimulationSettings.TargetClientFramerate; // SpatialOS.OnConnected += CreatePlayer; // break; // } // // // Enable communication with the SpatialOS layer of the simulation. //// SpatialOS.Connect(gameObject); // } public void Start() { SpatialOS.ApplyConfiguration(Configuration); // Time.fixedDeltaTime = 1.0f / SimulationSettings.FixedFramerate; switch (SpatialOS.Configuration.WorkerPlatform) { case WorkerPlatform.UnityWorker: Application.targetFrameRate = SimulationSettings.TargetServerFramerate; SpatialOS.OnDisconnected += reason => Application.Quit(); SpatialOS.Connect(gameObject); break; case WorkerPlatform.UnityClient: Application.targetFrameRate = SimulationSettings.TargetClientFramerate; SpatialOS.OnConnected += CreatePlayer; SpatialOS.OnDisconnected += reason => HandlePlayerDisconnect(); SceneManager.LoadSceneAsync(BuildSettings.SplashScreenScene, LoadSceneMode.Additive); break; } }
private void Start() { SpatialOS.ApplyConfiguration(Configuration); Time.fixedDeltaTime = 1.0f / SimulationSettings.FixedFramerate; // Distinguishes between when the Unity is running as a client or a server. switch (SpatialOS.Configuration.WorkerPlatform) { case WorkerPlatform.UnityWorker: Application.targetFrameRate = SimulationSettings.TargetServerFramerate; SpatialOS.OnDisconnected += reason => Application.Quit(); break; case WorkerPlatform.UnityClient: Application.targetFrameRate = SimulationSettings.TargetClientFramerate; SpatialOS.OnConnected += OnSpatialOsConnection; break; } SpatialOS.Connect(gameObject); }
public void Start() { SpatialOS.ApplyConfiguration(Configuration); switch (SpatialOS.Configuration.EnginePlatform) { case EnginePlatform.FSim: SpatialOS.OnDisconnected += reason => Application.Quit(); var targetFramerate = 120; var fixedFramerate = 20; Application.targetFrameRate = targetFramerate; Time.fixedDeltaTime = 1.0f / fixedFramerate; break; case EnginePlatform.Client: SpatialOS.OnConnected += OnConnected; break; } SpatialOS.Connect(gameObject); }
private void OnEnable() { SpatialOS.ApplyConfiguration(Configuration); Application.targetFrameRate = _targetFramerate; switch (SpatialOS.Configuration.EnginePlatform) { case EnginePlatform.FSim: { Time.fixedDeltaTime = 1.0f / _fixedFramerate; SpatialOS.OnDisconnected += reason => Application.Quit(); break; } case EnginePlatform.Client: { SpatialOS.OnConnected += OnConnected; break; } } SpatialOS.Connect(this.gameObject); }
// Called when the Play button is pressed in Unity. public void Start() { SceneManager.LoadScene(BuildSettings.SplashScreenScene, LoadSceneMode.Additive); SpatialOS.ApplyConfiguration(Configuration); Time.fixedDeltaTime = 1.0f / SimulationSettings.FixedFramerate; // Distinguishes between when the Unity is running as a client or a server. switch (SpatialOS.Configuration.WorkerPlatform) { case WorkerPlatform.UnityWorker: Application.targetFrameRate = SimulationSettings.TargetServerFramerate; SpatialOS.OnDisconnected += reason => Application.Quit(); SpatialOS.Connect(gameObject); break; case WorkerPlatform.UnityClient: Application.targetFrameRate = SimulationSettings.TargetClientFramerate; SpatialOS.OnConnected += CreatePlayer; break; } }