// Initial connection. void Start() { // Initialise map feature managers. obstacleManager = gameObject.AddComponent(typeof(ObstacleManager)) as ObstacleManager; scorePointManager = gameObject.AddComponent(typeof(ScorePointManager)) as ScorePointManager; pickupManager = gameObject.AddComponent(typeof(PickupManager)) as PickupManager; // Initialise player manager. playerManager = gameObject.AddComponent(typeof(PlayerManager)) as PlayerManager; if (Application.platform == RuntimePlatform.WebGLPlayer) { // Ask the browsers for setup calls. // (See unity.html for clarifications.) Debug.Log("Sending message to WebGLPlayer."); Application.ExternalCall("SendAllConnect"); } else { SetCurrentAvatarID(currentAvatarID); EstablishConnection(); } startTime = Time.time; dataQueue = new Queue <GameStateDTO>(); QualitySettings.antiAliasing = 8; }
// Initial connection. void Start() { // Initialise map feature managers. obstacleManager = new ObstacleManager(); scorePointManager = new ScorePointManager(); healthPointManager = new HealthPointManager(); pickupManager = new PickupManager(); // Initialise dictionary. mapFeatureManagers = new Dictionary <string, MapFeatureManager>(); mapFeatureManagers.Add(mapFeatureNames[0], obstacleManager); mapFeatureManagers.Add(mapFeatureNames[1], scorePointManager); mapFeatureManagers.Add(mapFeatureNames[2], healthPointManager); mapFeatureManagers.Add(mapFeatureNames[3], pickupManager); // Initialise player manager. playerManager = new PlayerManager(); if (Application.platform == RuntimePlatform.WebGLPlayer) { // Ask the browsers for setup calls. // (See unity.html for clarifications.) Debug.Log("Sending message to WebGLPlayer."); Application.ExternalCall("SendAllConnect"); } else { // TEMPORARY. Just for testing. Connect directly. Assume id = 1. EstablishConnection(); SetUserId(1); } startTime = Time.time; dataQueue = new Queue <JSONNode>(); }
void Start() { #if UNITY_EDITOR EstablishSocketConnection(); #endif // Initialise map feature managers. obstacleManager = gameObject.AddComponent(typeof(ObstacleManager)) as ObstacleManager; scorePointManager = gameObject.AddComponent(typeof(ScorePointManager)) as ScorePointManager; pickupManager = gameObject.AddComponent(typeof(PickupManager)) as PickupManager; // Initialise player manager. playerManager = gameObject.AddComponent(typeof(PlayerManager)) as PlayerManager; playerManager.playersCurrentAvatarID = currentAvatarID; Application.runInBackground = true; startTime = Time.time; QualitySettings.antiAliasing = 8; started = true; }