Mission refactoring (mission prefabs) and option to select which types of missions can be selected when mission type is set to random (TODO: a way to set the allowed types from the UI).

This commit is contained in:
Joonas Rikkonen
2018-05-17 23:45:29 +03:00
parent 244acd3ec5
commit f931d81aed
15 changed files with 273 additions and 191 deletions
@@ -16,9 +16,22 @@
: base(preset, param)
{
Location[] locations = { GameMain.GameSession.StartLocation, GameMain.GameSession.EndLocation };
MTRandom rand = new MTRandom(ToolBox.StringToInt(GameMain.NetLobbyScreen.LevelSeed));
mission = Mission.LoadRandom(locations, rand, param as string);
if (param is string)
{
mission = Mission.LoadRandom(locations, GameMain.NetLobbyScreen.LevelSeed, (string)param);
}
else if (param is MissionPrefab)
{
mission = ((MissionPrefab)param).Instantiate(locations);
}
else if (param is Mission)
{
mission = (Mission)param;
}
else
{
throw new System.ArgumentException("Unrecognized MissionMode parameter \"" + param + "\"");
}
}
}
}