public bool Init(string LevelScriptFileName) { _triggers.Clear(); _fibreVM = new CFibreVM(); // Game _fibreVM.PushInteropFunction("game_get_version", GetVersion); _fibreVM.PushInteropFunction("game_spawn_contract", ContractSpawn); _fibreVM.PushInteropFunction("game_spawn_resume", ResumeSpawn); //_fibreVM.PushInteropFunction("game_despawn", GameDespawn); // Item _fibreVM.PushInteropFunction("item_spawn", SpawnItem); _fibreVM.PushInteropFunction("item_set_locked", ItemSetLocked); _fibreVM.PushInteropFunction("item_set_available", SetItemAvailable); _fibreVM.PushInteropFunction("item_spawn_notify", NotifyNewItem); // Unit _fibreVM.PushInteropFunction("unit_spawn", SpawnUnit); _fibreVM.PushInteropFunction("unit_set_speech", SetUnitSpeech); _fibreVM.PushInteropFunction("unit_set_stamina", UnitSetStamina); _fibreVM.PushInteropFunction("unit_get_alive", UnitGetAlive); // Player _fibreVM.PushInteropFunction("game_set_win_money", SetWinMoney); _fibreVM.PushInteropFunction("game_set_fail_seconds", SetFailSeconds); _fibreVM.PushInteropFunction("game_set_population_cap", SetPopulationCap); _fibreVM.PushInteropFunction("game_set_intern_cap", SetInternCap); _fibreVM.PushInteropFunction("player_set_money", SetPlayerMoney); _fibreVM.PushInteropFunction("player_move_camera", CameraSetPosition); _fibreVM.PushInteropFunction("player_set_rep", PlayerSetRep); // Decal //_fibreVM.PushInteropFunction("decal_spawn", DecalSpawn); //_fibreVM.PushInteropFunction("decal_modify", DecalModify); // Audio //_fibreVM.PushInteropFunction("volume_spawn", VolumeSpawn); //_fibreVM.PushInteropFunction("volume_modify", VolumeModify); _fibreVM.PushInteropFunction("music_play", MusicPlay); _fibreVM.PushInteropFunction("sound_play", SoundPlay); // Cinematics _fibreVM.PushInteropFunction("cinematic_start", CinematicStart); _fibreVM.PushInteropFunction("cinematic_stop", CinematicStop); //_fibreVM.PushInteropFunction("cinematic_set_skip_start", CinematicStop); //_fibreVM.PushInteropFunction("cinematic_set_skip_end", CinematicStop); // AI _fibreVM.PushInteropFunction("ai_enable", AIEnable); // Waits _fibreVM.PushInteropFunction("wait_time", WaitTime); // Triggers _fibreVM.PushInteropFunction("trigger_tick", TriggerTick); _fibreVM.PushInteropFunction("trigger_entity_gone", TriggerEntityGone); _fibreVM.PushInteropFunction("trigger_unit_dead", TriggerUnitDead); try { _fibreVM.Compile(LevelScriptFileName); } catch (CFibreCompileException E) { Debug.LogError("FibreScript Compile: " + E.Message + " " + E.StackTrace); CGame.UIManager.ShowErrorMessage(E.Message, "Fibre Script Compile Exception"); Destroy(); return(false); } return(true); }
public void Destroy() { // TODO: Destroy more stuff properly? _world = null; _fibreVM = null; }