Skip to content

Commit 860ada7

Browse files
committed
Added MapGenerator showcase.
Improved MapGenerator scene. Added controls, options , and image export, and fixed bugs with the MapGenerator script. Refactor PauseMenu to use it in multiple showcases. Refactor LevelLoader to remove showcase references so it can be used outside of that context. Improve main menu to show more details for each showcase. Fixed some files from GOBs reading empty in some cases. Upgrade to latest Unity.
1 parent e5a51fb commit 860ada7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+28347
-1860
lines changed

Assets/Dark Forces Showcase/Inputs.inputactions

Lines changed: 693 additions & 329 deletions
Large diffs are not rendered by default.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using System.Linq;
2+
using System.Threading.Tasks;
3+
4+
namespace MZZT.DarkForces.Showcase {
5+
/// <summary>
6+
/// Script which powers the Level Explorer showcase.
7+
/// </summary>
8+
public class LevelExplorer : Singleton<LevelExplorer> {
9+
private async void Start() {
10+
// This is here in case you run directly from the LevelExplorer sccene instead of the menu.
11+
if (!FileLoader.Instance.Gobs.Any()) {
12+
await FileLoader.Instance.LoadStandardGobFilesAsync();
13+
}
14+
15+
await PauseMenu.Instance.BeginLoadingAsync();
16+
17+
ResourceCache.Instance.ClearWarnings();
18+
19+
await LevelLoader.Instance.LoadLevelListAsync(true);
20+
21+
await LevelLoader.Instance.ShowWarningsAsync("JEDI.LVL");
22+
23+
if (LevelLoader.Instance.CurrentLevelIndex >= 0) {
24+
await this.LoadAndRenderLevelAsync(LevelLoader.Instance.CurrentLevelIndex);
25+
}
26+
27+
PauseMenu.Instance.EndLoading();
28+
}
29+
30+
/// <summary>
31+
/// Load a level and generate Unity objects.
32+
/// </summary>
33+
public async Task LoadAndRenderLevelAsync(int levelIndex) {
34+
// Clear out existing level data.
35+
LevelMusic.Instance.Stop();
36+
LevelGeometryGenerator.Instance.Clear();
37+
ObjectGenerator.Instance.Clear();
38+
39+
await PauseMenu.Instance.BeginLoadingAsync();
40+
41+
await LevelMusic.Instance.PlayAsync(levelIndex);
42+
43+
await LevelLoader.Instance.LoadLevelAsync(levelIndex);
44+
if (LevelLoader.Instance.Level != null) {
45+
await LevelLoader.Instance.LoadColormapAsync();
46+
if (LevelLoader.Instance.ColorMap != null) {
47+
await LevelLoader.Instance.LoadPaletteAsync();
48+
if (LevelLoader.Instance.Palette != null) {
49+
await LevelGeometryGenerator.Instance.GenerateAsync();
50+
51+
await LevelLoader.Instance.LoadObjectsAsync();
52+
if (LevelLoader.Instance.Objects != null) {
53+
await ObjectGenerator.Instance.GenerateAsync();
54+
}
55+
}
56+
}
57+
}
58+
59+
await LevelLoader.Instance.ShowWarningsAsync();
60+
61+
PauseMenu.Instance.EndLoading();
62+
}
63+
}
64+
}

Assets/Dark Forces Showcase/LevelExplorer/LevelExplorer.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)