private void Start() { if (this.wsToken == -1) { this.wsToken = WorkScheduler.Register(new WorkScheduler.Task(this.RefreshVisibilityWork), base.transform.position, this.wsToken == -1); } }
private void Awake() { if (this.WsToken == -1) { this.WsToken = WorkScheduler.Register(this, base.transform.position, true); } }
public static void RegisterOneShot(WorkScheduler.Task task) { if (WorkScheduler.Instance != null) { WorkScheduler.Instance.registerOneShot(task); } }
private void OnDestroy() { try { if (this.wsToken >= 0) { WorkScheduler.Unregister(this, this.wsToken); this.wsToken = -1; } } catch { } if (FMOD_StudioEventEmitter.isShuttingDown) { return; } UnityUtil.Log("Destroy called"); if (this.IsEventInstanceValid()) { if (this.getPlaybackState() != PLAYBACK_STATE.STOPPED) { UnityUtil.Log("Release evt: '" + this.path + "'"); this.ERRCHECK(this.evt.stop(STOP_MODE.IMMEDIATE)); } this.ERRCHECK(this.evt.release()); this.evt = null; this.timeParameter = null; this.windParameter = null; } this.preStartAction = null; this.eventDescription = null; }
private void OnEnable() { if (this.WsToken == -1) { this.WsToken = WorkScheduler.Register(this, base.transform.position, false); } }
private void OnEnable() { if (this.WsToken == -1) { this.WsToken = WorkScheduler.Register(new WorkScheduler.Task(this.RefreshQueue), base.transform.position, false); } }
private void WSRegister() { if (this._wsToken == -1) { this._wsToken = WorkScheduler.Register(new WsTask(this.RainCheck), base.transform.position, false); } }
public void ShouldWaitForAllActionsToFinishBeforeReturning( [Column(0, 1, 2, 7, 19)] int numActions) { Stopwatch stopwatch = Stopwatch.StartNew(); bool[] finished = new bool[numActions]; GallioAction[] actions = new GallioAction[numActions]; for (int i = 0; i < numActions; i++) { int actionIndex = i; actions[i] = () => { Thread.Sleep((actionIndex + 1) * 71 % 37); TestLog.WriteLine("Iteration #{0} finished after {1}ms", actionIndex + 1, stopwatch.ElapsedMilliseconds); finished[actionIndex] = true; }; } var scheduler = new WorkScheduler(() => maxThreads); scheduler.Run(actions); for (int i = 0; i < numActions; i++) { Assert.IsTrue(finished[i]); } }
private void PerformScheduledSpawning() { if (!this || !base.gameObject || !base.gameObject.activeInHierarchy || !this.HasBeenRebuilt) { return; } int num = 0; for (int i = 0; i < this.CountX; i++) { for (int j = 0; j < GreebleLayer.CountY; j++) { for (int k = 0; k < this.CountZ; k++) { if (this.greebles[i, j, k].IsSpawning) { this.InstantiateGreeble(i, j, k); num++; if (num >= 5) { WorkScheduler.RegisterOneShot(new WsTask(this.PerformScheduledSpawning)); return; } } } } } }
private void Awake() { Scene.ActiveMB = this; Scene.GameStats = this._gameStats; Scene.SceneTracker = this._sceneTracker; Scene.MutantControler = this._mutantControler; Scene.MutantSpawnManager = this._mutantSpawnManager; Scene.Yacht = this._yacht; Scene.PlaneCrash = this._plane; Scene.PlaneCrashAnimGO = this._planeCrashAnimGO; Scene.TriggerCutScene = this._triggerCutScene; Scene.RainFollowGO = this._rainFollowGO; Scene.RainTypes = this._rainTypes; Scene.WeatherSystem = this._weatherSystem; Scene.HudGui = this._hudGui; Scene.Cams = this._cams; Scene.Clock = this._clock; Scene.Atmosphere = this._atmos; Scene.WorkScheduler = this._workScheduler; Scene.LoadSave = this._loadSave; Scene.PlaneGreebles = this._planeGreebles; Scene.OceanFlat = this._oceanFlat; Scene.OceanCeto = this._oceanCeto; Scene.ShoreMask = this._shoreMask; Scene.SinkHoleCenter = this._sinkHoleCenter; Scene.CaveGrounds = this._caveGrounds; }
private void OnDestroy() { Scene.ActiveMB = null; Scene.GameStats = null; Scene.SceneTracker = null; Scene.MutantControler = null; Scene.MutantSpawnManager = null; Scene.Yacht = null; Scene.PlaneCrash = null; Scene.PlaneCrashAnimGO = null; Scene.TriggerCutScene = null; Scene.RainFollowGO = null; Scene.RainTypes = null; Scene.WeatherSystem = null; Scene.HudGui = null; Scene.Cams = null; Scene.Clock = null; Scene.Atmosphere = null; Scene.WorkScheduler = null; Scene.LoadSave = null; Scene.PlaneGreebles = null; Scene.OceanFlat = null; Scene.OceanCeto = null; Scene.ShoreMask = null; Scene.SinkHoleCenter = null; Scene.CaveGrounds = null; }
private void OnExitMenu() { if (this.selected) { return; } this.selected = true; MenuMain.exitingToMenu = true; Time.timeScale = 1f; if (this.audio != null) { this.audio.PrepareForLevelLoad(); } WorkScheduler.ClearInstance(); UniqueIdentifier.AllIdentifiers.Clear(); RecastMeshObj.Clear(); if (BoltNetwork.isRunning) { if (MenuMain.< > f__mg$cache0 == null) { MenuMain.< > f__mg$cache0 = new Action(MenuMain.PostBoltShutdown); } base.StartCoroutine(this.WaitForBoltShutdown(MenuMain.< > f__mg$cache0)); return; } CoopTreeGrid.Clear(); GameSetup.SetInitType(InitTypes.New); GameSetup.SetGameType(GameTypes.Standard); GeoHash.ClearAll(); SceneManager.LoadScene("TitleSceneLoader", LoadSceneMode.Single); }
protected virtual void OnDisable() { if (!MenuMain.exitingToMenu) { WorkScheduler.Unregister(this, this.wsToken); this.canForceWorkScheduler = true; if (this.CurrentLodTransform) { if (this.lodWasDestroyed && this.Pool) { this.Pool.KillInstance(this.CurrentLodTransform); } else { this.DespawnCurrent(); } } this.lodWasDestroyed = false; this.CurrentLodTransform = null; this.isSpawned = false; this.currentLOD = -1; if (this.BillboardId >= 0 && this.cb != null) { this.cb.SetAlive(this.BillboardId, false); } if (!base.gameObject.activeSelf) { base.enabled = true; } } }
private void Awake() { this.xOffset = base.transform.position.x; this.yOffset = base.transform.position.z; if (WorkScheduler.Instance == null) { WorkScheduler.Instance = this; } else if (WorkScheduler.Instance != this) { UnityEngine.Object.DestroyImmediate(base.gameObject); } this.schedulers = new WorkSchedulerBatch[this.GridSize, this.GridSize]; for (int i = 0; i < this.GridSize; i++) { for (int j = 0; j < this.GridSize; j++) { this.schedulers[i, j] = new WorkSchedulerBatch(); } } this.globalScheduler = new WorkSchedulerBatch(); if (Application.isPlaying && !this.CaveScene && base.gameObject) { base.gameObject.SetActive(false); } }
public void CheckWsToken() { if (this.wsToken > -1 && !WorkScheduler.CheckTokenForPosition(this.position, this.wsToken)) { this.WSRegistration(false); this.ShouldDoMainThreadRefresh = true; } }
protected virtual void WSUnregister() { if (this._wsToken > -1) { WorkScheduler.Unregister(this, this._wsToken); this._wsToken = -1; } }
private void OnDisable() { if (this._wsToken != -1) { WorkScheduler.Unregister(new WsTask(this.CheckNextImage), this._wsToken); this._wsToken = -1; } }
private void Awake() { if (!LevelSerializer.IsDeserializing) { this.InitNonProxied(); } WorkScheduler.RegisterGlobal(new WsTask(this.CheckInCave), false); }
private void WSUnregister() { if (this._wsToken != -1) { WorkScheduler.Unregister(new WsTask(this.RainCheck), this._wsToken); this._wsToken = -1; } }
private void WSUnregister() { if (this._wsToken != -1) { WorkScheduler.Unregister(new WorkScheduler.Task(this.VisibilityCheck), this._wsToken); this._wsToken = -1; } }
private void OnDisable() { if (this.wsToken >= 0) { WorkScheduler.Unregister(new WorkScheduler.Task(this.UpdateVisibility), this.wsToken); this.Despawn(); } }
private void OwnershipCheckUnregister() { if (this._wsToken >= 0) { WorkScheduler.Unregister(new WsTask(this.OwnershipCheck), this._wsToken); this._wsToken = -1; } }
public void WSUnregister() { if (this._wsToken > -1) { WorkScheduler.Unregister(this, this._wsToken); this._wsToken = -1; } }
public void WSRegistration(bool doEnableRefresh) { if (this._wsToken != -1) { WorkScheduler.Unregister(this, this._wsToken); } this._wsToken = WorkScheduler.Register(this, this._position, true); }
private void OnDisable() { if (this.wsToken > -1) { WorkScheduler.Unregister(this, this.wsToken); this.wsToken = -1; } }
private void OnDisable() { if (this.WsToken != -1) { WorkScheduler.Unregister(new WorkScheduler.Task(this.RefreshQueue), this.WsToken); this.WsToken = -1; } }
private void OnDisable() { if (this.wsToken > -1) { WorkScheduler.Unregister(new WorkScheduler.Task(this.RefreshVisibilityWork), this.wsToken); this.wsToken = -1; } }
private void WSRegistration() { if (this.wsToken != -1) { WorkScheduler.Unregister(this, this.wsToken); } this.wsToken = WorkScheduler.Register(this, this.position, true); }
private void OnEnable() { base.InvokeRepeating("callSpawnCreatures", UnityEngine.Random.Range(0.1f, 4f), 4f); if (this.WsToken == -1) { this.WsToken = WorkScheduler.Register(this, base.transform.position, false); } }
public void CheckWsToken2() { this.position = base.transform.position; if (this.wsToken > -1 && !WorkScheduler.CheckTokenForPosition(this.position, this.wsToken)) { this.WSRegistration(); this.ShouldDoMainThreadRefresh = false; } }
private static void CheckConfig() { if (WorkScheduler.Instance == null && !WorkScheduler.configWarningIssued && Application.isPlaying) { UnityEngine.Debug.LogWarning("No Work Scheduler found, please add one. (From the Menu: GameObject/The Forest/Work Scheduler)"); WorkScheduler.configWarningIssued = true; WorkScheduler.AddWorkScheduler(); } }
public static void RegisterGlobal(WorkScheduler.Task task, bool force = false) { WorkScheduler.CheckConfig(); WorkScheduler.Instance.registerGlobal(task, force); }
public static void UnregisterGlobal(WorkScheduler.Task task) { if (WorkScheduler.Instance != null) { WorkScheduler.Instance.unregisterGlobal(task); } }
private int register(WorkScheduler.Task task, Vector3 position, bool force) { int num = Mathf.Clamp(this.WorldToGridX(position.x), 0, this.GridSize - 1); int num2 = Mathf.Clamp(this.WorldToGridY(position.z), 0, this.GridSize - 1); this.schedulers[num, num2].Register(task, force); return num * this.GridSize + num2; }
private void registerGlobal(WorkScheduler.Task task, bool force) { this.globalScheduler.Register(task, force); }
public static int Register(WorkScheduler.Task task, Vector3 position, bool force = false) { WorkScheduler.CheckConfig(); return WorkScheduler.Instance.register(task, position, force); }
private void unregister(WorkScheduler.Task task, int token) { int num = Mathf.Clamp(token / this.GridSize, 0, this.GridSize - 1); int num2 = Mathf.Clamp(token - num * this.GridSize, 0, this.GridSize - 1); this.schedulers[num, num2].Unregister(task); }
private void unregisterGlobal(WorkScheduler.Task task) { this.globalScheduler.Unregister(task); }
public static void Unregister(WorkScheduler.Task task, int token) { if (WorkScheduler.Instance != null) { WorkScheduler.Instance.unregister(task, token); } }
private void registerOneShot(WorkScheduler.Task task) { this.oneShotScheduler.Register(task, true); }