-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_inside_a_game.asl
50 lines (41 loc) · 997 Bytes
/
game_inside_a_game.asl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
state("Game Inside a Game") { }
startup
{
Assembly.Load(File.ReadAllBytes("Components/asl-help")).CreateInstance("Unity");
vars.Helper.GameName = "Game Inside a Game";
vars.Helper.LoadSceneManager = true;
vars.CompletedLevels = new HashSet<int>();
}
init
{
vars.Helper.TryLoad = (Func<dynamic, bool>)(mono =>
{
var LB = mono["LevelBuilder"];
vars.Helper["level"] = LB.Make<int>(
"curLevelNum"
);
var SM = mono["SensorMonitor"];
vars.Helper["levelWon"] = SM.Make<bool>(
"Instance",
"conditionsMet"
);
return true;
});
current.activeScene = "";
}
update
{
current.activeScene = vars.Helper.Scenes.Active.Name ?? current.activeScene;
}
start
{
return old.activeScene == "Title" && current.activeScene == "Game";
}
onStart
{
vars.CompletedLevels.Clear();
}
split
{
return !old.levelWon && current.levelWon && vars.CompletedLevels.Add(current.level);
}