public void UpdateChunk() { if (pageState != TerrainComponent.PageState.Unloaded) { } else if (pageState == TerrainComponent.PageState.Unloaded) { if (hasPhysics) { chunk.RemovePhysics(); for (int i = 0; i < chunk.Controllers.Count; i++) { Controller ctrlr = chunk.Controllers[i]; ctrlr.Destroy(); chunk.RemoveController(ctrlr); ctrlr = null; } hasPhysics = false; } component.OnRemoveChunk(chunk); } if (pageState == TerrainComponent.PageState.Loaded) { if (!hasPhysics) { chunk.AddPhysics(); hasPhysics = true; component.OnAddChunk(chunk); } unloadTime = 0f; } else if (pageState == TerrainComponent.PageState.Unloading) { if (unloadTime > 5f) { pageState = TerrainComponent.PageState.Unloaded; } unloadTime += component.Environment.TimePerFrame * 10f; } }
public void UpdateChunk() { if (pageState != TerrainComponent.PageState.Unloaded) { } else if (pageState == TerrainComponent.PageState.Unloaded) { if (hasPhysics) { chunk.RemovePhysics(); for (int i = 0; i < chunk.Controllers.Count; i++) { Controller ctrlr = chunk.Controllers[i]; ctrlr.Destroy(); chunk.RemoveController(ctrlr); ctrlr = null; } hasPhysics = false; } component.OnRemoveChunk(chunk); } if (pageState == TerrainComponent.PageState.Loaded) { if (!hasPhysics) { chunk.AddPhysics(); hasPhysics = true; component.OnAddChunk(chunk); } unloadTime = 0f; } else if (pageState == TerrainComponent.PageState.Unloading) { if (unloadTime > 5f) { pageState = TerrainComponent.PageState.Unloaded; } unloadTime += component.Environment.TimePerFrame * 10f; } }