private IEnumerator LoadingDone() { this.OnLoadingDone(); yield return(null); if (GameSetup.Init == InitTypes.Continue) { while (LevelSerializer.IsDeserializing || PlayerSpawn.LoadSavedCharacter) { yield return(null); } } yield return(null); string name = "Unknown"; if (!CoopPeerStarter.DedicatedHost) { name = SteamFriends.GetPersonaName(); if (name == null || name.Trim().Length == 0) { yield return(null); name = SteamFriends.GetPersonaName(); if (name == null || name.Trim().Length == 0) { name = "Unknown"; } } while (!LocalPlayer.GameObject) { yield return(null); } Debug.Log("Attach local player"); CoopUtils.AttachLocalPlayer(name); } try { BoltNetwork.UpdateSceneObjectsLookup(); } catch (Exception exception) { Debug.LogError("Failed to attach scene objects, ask on slack for a CoopPeerStarter MP debug ASAP"); Debug.LogException(exception); } BoltNetwork.SetCanReceiveEntities(true); UnityEngine.Object.Destroy(base.gameObject); if (this.gui) { UnityEngine.Object.Destroy(this.gui); } yield break; }
private void OnGameStart() { try { AnimalSpawnController.lastUpdate = Time.realtimeSinceStartup + 30f; try { BoltNetwork.UpdateSceneObjectsLookup(); } catch (Exception) { } CoopTreeGrid.Update(BoltNetwork.SceneObjects); this.AttachBuildings(); } finally { LoadSave.OnGameStart -= this.OnGameStart; } }
protected void Update() { CoopPeerStarter.MapState mapState = this.mapState; if (mapState != CoopPeerStarter.MapState.Begin) { if (mapState != CoopPeerStarter.MapState.Loading) { if (mapState == CoopPeerStarter.MapState.Done) { try { BoltNetwork.UpdateSceneObjectsLookup(); } catch (Exception) { } Camera componentInChildren = base.GetComponentInChildren <Camera>(); if (componentInChildren) { componentInChildren.enabled = false; } base.StartCoroutine(this.LoadingDone()); this.mapState = CoopPeerStarter.MapState.Playing; } } else if (!this.GetAsync() || this.GetAsync().isDone) { this.mapState = CoopPeerStarter.MapState.Done; } } else { CoopPlayerCallbacks.ClearTrees(); LoadAsync async = this.GetAsync(); if (async) { async.gameObject.SetActive(true); this.mapState = CoopPeerStarter.MapState.Loading; } } }
public override void OnEnter() { BoltNetwork.UpdateSceneObjectsLookup(); Finish(); }