Revamp the prompt system, the bootstrapper system, the starting cinematic
This commit is contained in:
@@ -31,15 +31,37 @@ namespace Bootstrap
|
||||
RuntimeContainer = new GameObject($"{name}_Container");
|
||||
DontDestroyOnLoad(RuntimeContainer);
|
||||
Instances = new GameObject[BootPrefabs.Length];
|
||||
|
||||
// Calculate total prefabs for progress tracking
|
||||
int totalPrefabs = BootPrefabs.Length;
|
||||
float progressPerPrefab = totalPrefabs > 0 ? 1f / totalPrefabs : 1f;
|
||||
float currentProgress = 0f;
|
||||
|
||||
for (var i = 0; i < BootPrefabs.Length; i++)
|
||||
{
|
||||
if (!BootPrefabs[i]) continue;
|
||||
if (!BootPrefabs[i])
|
||||
{
|
||||
// Report incremental progress even for null prefabs
|
||||
currentProgress = (i + 1) * progressPerPrefab;
|
||||
CustomBoot.UpdateProgress(currentProgress);
|
||||
continue;
|
||||
}
|
||||
|
||||
var instance = GameObject.InstantiateAsync(BootPrefabs[i], RuntimeContainer.transform);
|
||||
while (!instance.isDone)
|
||||
{
|
||||
// Report partial progress while waiting
|
||||
float progressInStep = instance.progress * progressPerPrefab;
|
||||
float overallProgress = i * progressPerPrefab + progressInStep;
|
||||
CustomBoot.UpdateProgress(overallProgress);
|
||||
await Task.Yield();
|
||||
}
|
||||
|
||||
Instances[i] = instance.Result[0];
|
||||
|
||||
// Report completion of this step
|
||||
currentProgress = (i + 1) * progressPerPrefab;
|
||||
CustomBoot.UpdateProgress(currentProgress);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,12 +77,28 @@ namespace Bootstrap
|
||||
}
|
||||
|
||||
Instances = new GameObject[BootPrefabs.Length];
|
||||
|
||||
// Calculate total prefabs for progress tracking
|
||||
int totalPrefabs = BootPrefabs.Length;
|
||||
float progressPerPrefab = totalPrefabs > 0 ? 1f / totalPrefabs : 1f;
|
||||
float currentProgress = 0f;
|
||||
|
||||
for (var i = 0; i < BootPrefabs.Length; i++)
|
||||
{
|
||||
if (!BootPrefabs[i]) continue;
|
||||
if (!BootPrefabs[i])
|
||||
{
|
||||
// Report incremental progress even for null prefabs
|
||||
currentProgress = (i + 1) * progressPerPrefab;
|
||||
CustomBoot.UpdateProgress(currentProgress);
|
||||
continue;
|
||||
}
|
||||
|
||||
var instance = GameObject.Instantiate(BootPrefabs[i], RuntimeContainer.transform);
|
||||
Instances[i] = instance;
|
||||
|
||||
// Report completion of this step
|
||||
currentProgress = (i + 1) * progressPerPrefab;
|
||||
CustomBoot.UpdateProgress(currentProgress);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user