Ejemplo n.º 1
0
    /// <summary> Loads a battle </summary>
    public void LoadEssentials()
    {
        FileReader.FileLog("Begin Loading", FileLogType.loader);
        placeholder         = GameObject.Find("Placeholder");
        general             = placeholder.GetComponent <GeneralExecution>();
        general.loader      = this;
        general.battle_path = path;

        m_core = general.mission_core;

        List <DataStructure> conversations = new List <DataStructure>();

        foreach (DataStructure child in BattleData.AllChildren)
        {
            string name = child.Name;
            switch (name)
            {
            case "general":
                ChangeScenerie(scenerie_dict [child.Get <string>("planet")]);
                SceneGlobals.battlefiled_size         = child.Get("size", 1000, quiet: true);
                SceneGlobals.ship_camera.farClipPlane = SceneGlobals.battlefiled_size;
                SceneGlobals.map_camera.farClipPlane  = SceneGlobals.battlefiled_size;
                break;

            case "conversation":
                conversations.Add(child);
                break;

            case "story":
                FileReader.FileLog("Load Story", FileLogType.loader);
                Dictionary <ushort, DataStructure> story = new Dictionary <ushort, DataStructure>();
                foreach (DataStructure stage in child.AllChildren)
                {
                    // Checks if string matches "StageX", where X is an integer between 0 and 9999
                    if (Regex.IsMatch(stage.Name, @"^[sS]tage\d{1,4}$"))
                    {
                        ushort number = System.UInt16.Parse(stage.Name.Substring(5));
                        story [number] = stage;
                    }
                }
                m_core.story             = story;
                m_core.in_level_progress = (short)(child.Contains <ushort>("startstage") ? child.Get <ushort>("startstage") : 0);
                break;
            }
        }

        m_core.conversations = conversations.ToArray();
    }
Ejemplo n.º 2
0
 /// <summary> Gets called from the Loader, before he is loading </summary>
 public void PreLoading()
 {
     loader       = Globals.persistend.loader;
     os           = new OperatingSystem(null, SceneGlobals.Player);
     mission_core = new MissionCore(console, loader);
 }