public void Sim200ms(float time_delta) { find_top_priority_job.Reset(null); FindTopPriorityTask.abort = false; int num = 512; for (int i = 0; i < Components.Prioritizables.Items.Count; i += num) { int num2 = i + num; if (Components.Prioritizables.Items.Count < num2) { num2 = Components.Prioritizables.Items.Count; } find_top_priority_job.Add(new FindTopPriorityTask(i, num2)); } GlobalJobManager.Run(find_top_priority_job); bool on = false; for (int j = 0; j != find_top_priority_job.Count; j++) { FindTopPriorityTask workItem = find_top_priority_job.GetWorkItem(j); if (workItem.found) { on = true; break; } } VignetteManager.Instance.Get().HasTopPriorityChore(on); }
private void RenderMesh(float z, int render_layer, float lerp_percent, bool trigger_audio) { GridArea visibleArea = GridVisibleArea.GetVisibleArea(); Vector2I min = visibleArea.Min; int a = Mathf.Max(0, min.x - 1); Vector2I min2 = visibleArea.Min; Vector2I min3 = new Vector2I(a, Mathf.Max(0, min2.y - 1)); int a2 = Grid.WidthInCells - 1; Vector2I max = visibleArea.Max; int a3 = Mathf.Min(a2, max.x + 1); int a4 = Grid.HeightInCells - 1; Vector2I max2 = visibleArea.Max; Vector2I max3 = new Vector2I(a3, Mathf.Min(a4, max2.y + 1)); RenderMeshContext shared_data = new RenderMeshContext(this, lerp_percent, min3, max3); if (shared_data.visible_conduits.Count == 0) { shared_data.Finish(); } else { render_mesh_job.Reset(shared_data); int num = Mathf.Max(1, (int)((float)(shared_data.visible_conduits.Count / CPUBudget.coreCount) / 1.5f)); int num2 = Mathf.Max(1, shared_data.visible_conduits.Count / num); for (int i = 0; i != num2; i++) { int num3 = i * num; int end = (i != num2 - 1) ? (num3 + num) : shared_data.visible_conduits.Count; render_mesh_job.Add(new RenderMeshTask(num3, end)); } GlobalJobManager.Run(render_mesh_job); float z2 = 0f; if (showContents) { z2 = 1f; } int num4 = (int)(animTime / (1.0 / (double)tuning.framesPerSecond)) % (int)tuning.spriteCount; float w = (float)num4 * (1f / tuning.spriteCount); movingBallMesh.Begin(); movingBallMesh.SetTexture("_BackgroundTex", tuning.backgroundTexture); movingBallMesh.SetTexture("_ForegroundTex", tuning.foregroundTexture); movingBallMesh.SetVector("_SpriteSettings", new Vector4(1f / tuning.spriteCount, 1f, z2, w)); movingBallMesh.SetVector("_Highlight", new Vector4((float)(int)highlightColour.r / 255f, (float)(int)highlightColour.g / 255f, (float)(int)highlightColour.b / 255f, 0f)); staticBallMesh.Begin(); staticBallMesh.SetTexture("_BackgroundTex", tuning.backgroundTexture); staticBallMesh.SetTexture("_ForegroundTex", tuning.foregroundTexture); staticBallMesh.SetVector("_SpriteSettings", new Vector4(1f / tuning.spriteCount, 1f, z2, 0f)); staticBallMesh.SetVector("_Highlight", new Vector4((float)(int)highlightColour.r / 255f, (float)(int)highlightColour.g / 255f, (float)(int)highlightColour.b / 255f, 0f)); Vector3 position = CameraController.Instance.transform.GetPosition(); ConduitFlowVisualizer visualizer = (!trigger_audio) ? null : this; for (int j = 0; j != render_mesh_job.Count; j++) { render_mesh_job.GetWorkItem(j).Finish(movingBallMesh, staticBallMesh, position, visualizer); } movingBallMesh.End(z, layer); staticBallMesh.End(z, layer); shared_data.Finish(); } }
public static void FindEggToGuard(List <UpdateBucketWithUpdater <Instance> .Entry> instances, float time_delta) { ListPool <KPrefabID, EggProtectionMonitor> .PooledList pooledList = ListPool <KPrefabID, EggProtectionMonitor> .Allocate(); pooledList.Capacity = Mathf.Max(pooledList.Capacity, Components.Pickupables.Count); IEnumerator enumerator = Components.Pickupables.GetEnumerator(); try { while (enumerator.MoveNext()) { Pickupable pickupable = (Pickupable)enumerator.Current; pooledList.Add(pickupable.gameObject.GetComponent <KPrefabID>()); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } ListPool <Egg, EggProtectionMonitor> .PooledList pooledList2 = ListPool <Egg, EggProtectionMonitor> .Allocate(); find_eggs_job.Reset(pooledList); for (int i = 0; i < pooledList.Count; i += 256) { find_eggs_job.Add(new FindEggsTask(i, Mathf.Min(i + 256, pooledList.Count))); } GlobalJobManager.Run(find_eggs_job); for (int j = 0; j != find_eggs_job.Count; j++) { find_eggs_job.GetWorkItem(j).Finish(pooledList, pooledList2); } pooledList.Recycle(); foreach (UpdateBucketWithUpdater <Instance> .Entry instance in instances) { UpdateBucketWithUpdater <Instance> .Entry current = instance; GameObject eggToGuard = null; int num = 100; foreach (Egg item in pooledList2) { Egg current2 = item; int navigationCost = current.data.navigator.GetNavigationCost(current2.cell); if (navigationCost != -1 && navigationCost < num) { eggToGuard = current2.game_object; num = navigationCost; } } current.data.SetEggToGuard(eggToGuard); } pooledList2.Recycle(); }
public static void ModifyBrightness(List <UpdateBucketWithUpdater <Instance> .Entry> instances, ModifyLuxDelegate modify_lux, float time_delta) { modify_brightness_job.Reset(null); for (int i = 0; i != instances.Count; i++) { UpdateBucketWithUpdater <Instance> .Entry value = instances[i]; value.lastUpdateTime = 0f; instances[i] = value; Instance data = value.data; modify_lux(data, time_delta); data.light.Range = data.originalRange * (float)data.light.Lux / (float)data.originalLux; data.light.RefreshShapeAndPosition(); if (data.light.RefreshShapeAndPosition() != 0) { modify_brightness_job.Add(new ModifyBrightnessTask(data.light.emitter)); } } GlobalJobManager.Run(modify_brightness_job); for (int j = 0; j != modify_brightness_job.Count; j++) { modify_brightness_job.GetWorkItem(j).Finish(); } }