private void GenerateClickableMap(MapInfos mapInfos) { GameObject ClickableMap = new GameObject("MapClickable"); ClickableMap.transform.parent = this.transform; for (int y = 0; y < mapInfos.Layout.SizeY; y++) { for (int x = 0; x < mapInfos.Layout.SizeX; x++) { if (mapInfos.Layout.Layout[x, y] != (int)BlocHeight.Empty) { GameObject projection = Instantiate(ClickableCellTemplate); projection.transform.parent = ClickableMap.transform; projection.transform.position = projection.transform.position + mapInfos.Map[x, y].GetVector3Position(); mapInfos.ProjectionMap[x, y] = projection.GetComponent <ProjectionRenderer>(); mapInfos.ProjectionMap[x, y].enabled = false; float height = (int)mapInfos.Map[x, y].Y; BoxCollider collider = projection.GetComponent <BoxCollider>(); collider.center = new Vector3(0, 0, 0.4f + (height / 2)); collider.size = new Vector3(1.1f, 1.1f, 1.1f * height); } } } }
// Check if layout is good enough to be played private bool mapIsPlayable(MapInfos mapInfos) { // Check % of non-walkable cells if (mapInfos.MapData != null && mapInfos.MapData.NonWalkableCheck) { float validCells = 0; float nonWalkableCells = 0; for (int i = 0; i < SizeX; i++) { for (int j = 0; j < SizeY; j++) { if (Layout[i, j] != -1) { validCells++; } if (Layout[i, j] == 0) { nonWalkableCells++; } } } float percentNonWalkables = nonWalkableCells / validCells; if (percentNonWalkables > mapInfos.MapData.MaxNonWalkable || percentNonWalkables < mapInfos.MapData.MinNonWalkable) { return(false); } } return(true); }
private static List <Cell> GetNeighbours(MapInfos map, Cell cell) { List <Cell> neighbours = new List <Cell>(); if (cell.X + 1 >= 0 && cell.X + 1 < map.Size.x && cell.Z >= 0 && cell.Z < map.Size.y && Mathf.Abs(map.Map[cell.X + 1, cell.Z].Y - cell.Y) <= 1) { neighbours.Add(map.Map[cell.X + 1, cell.Z]); } if (cell.X - 1 >= 0 && cell.X - 1 < map.Size.x && cell.Z >= 0 && cell.Z < map.Size.y && Mathf.Abs(map.Map[cell.X - 1, cell.Z].Y - cell.Y) <= 1) { neighbours.Add(map.Map[cell.X - 1, cell.Z]); } if (cell.X >= 0 && cell.X < map.Size.x && cell.Z + 1 >= 0 && cell.Z + 1 < map.Size.y && Mathf.Abs(map.Map[cell.X, cell.Z + 1].Y - cell.Y) <= 1) { neighbours.Add(map.Map[cell.X, cell.Z + 1]); } if (cell.X >= 0 && cell.X < map.Size.x && cell.Z - 1 >= 0 && cell.Z - 1 < map.Size.y && Mathf.Abs(map.Map[cell.X, cell.Z - 1].Y - cell.Y) <= 1) { neighbours.Add(map.Map[cell.X, cell.Z - 1]); } return(neighbours); }
public static float[,] GetInfluenceMap(MapInfos mapInfos, Team teamToSeek) { mapSizeX = (int)mapInfos.Size.x; mapSizeY = (int)mapInfos.Size.y; float[,] influences = new float[mapSizeX, mapSizeY]; float[,] influencesBuffer = new float[mapSizeX, mapSizeY]; SetUnits(influences, influencesBuffer, mapInfos.Map, teamToSeek); int cpt = 0; do { UpdateInfluenceMap(influences, influencesBuffer, mapInfos.Map); UpdateInfluenceBuffer(influences, influencesBuffer); PrintMap(influences); Debug.Log("iteration n°" + cpt); cpt++; } while (!PropagationIsComplete(influences, mapInfos.Map)); RemoveTakenCells(influences, mapInfos.Map); return(influences); }
public static string Style(MapInfos map) { if (map != null && !string.IsNullOrEmpty(map.preview)) { return($"background-image: url({map.preview});"); } return(""); }
/// <summary> /// Get table of of bizName /// </summary> /// <param name="bizName"></param> /// <returns></returns> public string GetTableName(string bizName) { if (MapInfos.ContainsKey(bizName)) { return(MapInfos[bizName].TableName); } return(bizName); }
public static List <Cell> FindPath(MapInfos map, Cell startCell, Cell targetCell, bool exceptLastCell = false) { // find path List <Cell> path = _ImpFindPath(map, startCell, targetCell, exceptLastCell); ClearPathfinding(map); return(path); }
/// <summary> /// Get column name of biz name /// </summary> /// <param name="bizName"></param> /// <returns></returns> public string GetColumnName(string bizName) { if (MapInfos.ContainsKey(bizName)) { return(MapInfos[bizName].ColumnName); } return(bizName); }
// internal function to find path, don't use this one from outside private static List <Cell> _ImpFindPath(MapInfos map, Cell startCell, Cell targetCell, bool exceptLastCell) { List <Cell> openSet = new List <Cell>(); HashSet <Cell> closedSet = new HashSet <Cell>(); openSet.Add(startCell); while (openSet.Count > 0) { Cell currentNode = openSet[0]; for (int i = 1; i < openSet.Count; i++) { if (openSet[i].FCost < currentNode.FCost || openSet[i].FCost == currentNode.FCost && openSet[i].HCost < currentNode.HCost) { currentNode = openSet[i]; } } openSet.Remove(currentNode); closedSet.Add(currentNode); if (currentNode == targetCell) { return(RetracePath(startCell, targetCell)); } foreach (Cell neighbour in GetNeighbours(map, currentNode)) { if (exceptLastCell && targetCell.IsTaken && neighbour == targetCell) { neighbour.Parent = currentNode; return(RetracePath(startCell, neighbour)); } if (!neighbour.IsWalkable || (!exceptLastCell && neighbour.IsTaken != null) || closedSet.Contains(neighbour)) { continue; } int newMovementCostToNeighbour = currentNode.GCost + Utils.GetDistanceBetweenCells(currentNode, neighbour); if (newMovementCostToNeighbour < neighbour.GCost || !openSet.Contains(neighbour)) { neighbour.GCost = newMovementCostToNeighbour; neighbour.HCost = Utils.GetDistanceBetweenCells(neighbour, targetCell); neighbour.Parent = currentNode; if (!openSet.Contains(neighbour)) { openSet.Add(neighbour); } } } } return(null); }
private void MasterHandler(api_start2 api) { MapAreas = new IDTable <int, MapArea>(api.api_mst_maparea.Select(x => new MapArea(x))); MapInfos.UpdateAll(api.api_mst_mapinfo, x => x.api_id); ShipTypes = new IDTable <int, ShipType>(api.api_mst_stype.Select(x => new ShipType(x))); ShipInfo = new IDTable <int, ShipInfo>(api.api_mst_ship.Select(x => new ShipInfo(x))); EquipTypes = new IDTable <int, EquipType>(api.api_mst_slotitem_equiptype.Select(x => new EquipType(x))); EquipInfo = new IDTable <int, EquipInfo>(api.api_mst_slotitem.Select(x => new EquipInfo(x))); MissionInfo = new IDTable <int, MissionInfo>(api.api_mst_mission.Select(x => new MissionInfo(x))); UseItems = new IDTable <int, UseItem>(api.api_mst_useitem.Select(x => new UseItem(x))); }
public MapLayout(MapInfos mapInfos) { SizeX = (mapInfos.Size.x <= 0 ? 1 : mapInfos.Size.x); SizeY = (mapInfos.Size.y <= 0 ? 1 : mapInfos.Size.y); Layout = new int[(int)SizeX, (int)SizeY]; do { FillLayout(mapInfos); } while (!mapIsPlayable(mapInfos)); }
private static void ClearPathfinding(MapInfos map) { for (int x = 0; x < map.Size.x; x++) { for (int y = 0; y < map.Size.y; y++) { map.Map[x, y].GCost = 0; map.Map[x, y].HCost = 0; map.Map[x, y].Parent = null; } } }
private void GenerateMap(MapInfos mapInfos) { GameObject MapObject = new GameObject("Map"); MapObject.layer = 8; MapObject.transform.parent = this.transform; mapInfos.ProjectionMap = new ProjectionRenderer[(int)mapInfos.Size.x, (int)mapInfos.Size.y]; if (mapInfos.Map == null) { mapInfos.Layout = new MapLayout(mapInfos); mapInfos.Map = new Cell[(int)mapInfos.Size.x, (int)mapInfos.Size.y]; for (int y = 0; y < mapInfos.Layout.SizeY; y++) { for (int x = 0; x < mapInfos.Layout.SizeX; x++) { if (mapInfos.Layout.Layout[x, y] != (int)BlocHeight.Empty) { mapInfos.Map[x, y] = new Cell(x, y, mapInfos.Layout.Layout[x, y], MapObject.transform, CellTemplate, mapInfos.MapData.BlocTypes[mapInfos.Layout.Layout[x, y]].Variations[Random.Range(0, mapInfos.MapData.BlocTypes[mapInfos.Layout.Layout[x, y]].Variations.Length - 1)], mapInfos.MapData.BlocTypes[mapInfos.Layout.Layout[x, y]].Variations[mapInfos.MapData.BlocTypes[mapInfos.Layout.Layout[x, y]].Variations.Length - 1]); mapInfos.Map[x, y].BuildCell(MapObject.transform, CellTemplate); } else { mapInfos.Map[x, y] = new Cell(x, y); } } } } else { for (int y = 0; y < mapInfos.Layout.SizeY; y++) { for (int x = 0; x < mapInfos.Layout.SizeX; x++) { if (mapInfos.Layout.Layout[x, y] != (int)BlocHeight.Empty) { mapInfos.Map[x, y].BuildCell(MapObject.transform, CellTemplate); } } } } MapObject.CombineMeshes(); MapObject.GetSimplifiedMeshInBackground(1f, true, 1f, res => MapObject.GetComponent <MeshCollider>().sharedMesh = res); }
private void InitMapInfos(int mapId) { MapInfos info = new MapInfos(); info.allmonster = serverModel.monsterList.data; info.npcs = GetSceneObjOnListByMapId(serverModel.npcList.data, mapId); info.transfers = GetSceneElementOnListByMapId(serverModel.doorList.data, mapId); info.playerSpawn = GetSceneObjOnListByMapId(serverModel.playerSpawn.data, mapId); info.monsterSpawn = GetSceneObjOnListByMapId(serverModel.monsterSpawn.data, mapId); serverModel.mapInfos = info; string sid = serverModel.mapVo.mapresid.ToString(); EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); //询问有修改的场景时的 保存当前修改场景 EditorSceneManager.OpenScene(string.Format(sceneAssetsRoot, sid)); // 打开场景 EditorMapView.mapName = serverModel.mapVo.map_name; sceneConfigVo = EditorSceneConfigLoader.importScene(mapId);// 导入场景数据 if (sceneConfigVo != null) { sceneConfigVo.resId = sid; for (int i = 0; i < sceneConfigVo.monster.Count; i++) { ClientElementInfo monInfo = sceneConfigVo.monster[i]; for (int j = 0; j < serverModel.monsterList.data.Count; j++) { SceneObjVo monVo = serverModel.monsterList.data[j]; } } info.monsters = sceneConfigVo.monster; } //加载服务器传来的怪物数据 EditorNpcLoader.load(); //载入NPC EditorElementLoader.load(); // 载入传送门 EditorMonsterLoader.load(); // 载入Monster EditorPlayerSpawnLoader.load(); // 载入玩家出生点 EditorMonsterSpawnLoader.load(); // 载入刷怪区 Rect wr = new Rect(0, 0, 310, 260); MapEditor window = (MapEditor)GetWindowWithRect(typeof(MapEditor), wr, true, "地图编辑器"); window.editSceneVo.isImportMap = true; window.editSceneVo.sceneId = mapId; window.Show(); this.Close(); }
private void FillLayout(MapInfos mapInfos) { float randomNoise = Random.Range(0, 10000); float maxRay = Mathf.Sqrt(Mathf.Pow((0 - SizeX / 2), 2) + Mathf.Pow((0 - SizeY / 2), 2)) * 0.85f; float minRay = maxRay * 0.9f; for (int x = 0; x < SizeX; x++) { double ray = Random.Range(minRay, maxRay); for (int y = 0; y < SizeY; y++) { if (GetDistanceFromCenter(x, y) < ray) { Vector2 pos = mapInfos.MapData.Zoom * (new Vector2(x, y)); float noise = Mathf.PerlinNoise(pos.x + randomNoise, pos.y + randomNoise); if (noise < mapInfos.MapData.BlocHeight[0]) { Layout[x, y] = (int)BlocHeight.NonWalkable; } else if (noise < mapInfos.MapData.BlocHeight[1]) { Layout[x, y] = (int)BlocHeight.SeaLevel; } else if (noise < mapInfos.MapData.BlocHeight[2]) { Layout[x, y] = (int)BlocHeight.Ground; } else if (noise < mapInfos.MapData.BlocHeight[3]) { Layout[x, y] = (int)BlocHeight.Middle; } else { Layout[x, y] = (int)BlocHeight.Top; } } else { Layout[x, y] = (int)BlocHeight.Empty; } } } }
public static MapInfos Deserialize(MapInfosSerializable serializedData, DatabasePreset materialsPreset, List <Player> player, List <Enemy> enemies) { MapInfos mapInfos = new MapInfos(); string path = "MapData/" + serializedData.MapDataType.ToString(); mapInfos.MapData = Resources.Load <ScriptableObject>(path) as MapData; mapInfos.Size = new Vector2(serializedData.SizeX, serializedData.SizeY); mapInfos.Layout = serializedData.Layout; if (serializedData.Map != null) { Dictionary <string, Material> materials = new Dictionary <string, Material>(); Dictionary <string, string> materialsDatabase = DataSerialization.ReadDatabasePathByName(materialsPreset); foreach (string name in serializedData.Materials) { if (materialsDatabase.ContainsKey(name)) { materials.Add(name, Resources.Load <Material>(materialsDatabase[name])); } else { Debug.Log("Material " + name + " not found in DB"); } } Cell[,] newMap = new Cell[serializedData.SizeX, serializedData.SizeY]; for (int x = 0; x < serializedData.SizeX; x++) { for (int y = 0; y < serializedData.SizeY; y++) { newMap[x, y] = new Cell(); if (serializedData.Map[x, y].UnitId != -1) { newMap[x, y].IsTaken = GetUnitById(serializedData.Map[x, y].UnitId, player, enemies); } newMap[x, y].IsWalkable = serializedData.Map[x, y].IsWalkable; newMap[x, y].X = serializedData.Map[x, y].X; newMap[x, y].Y = serializedData.Map[x, y].Y; newMap[x, y].Z = serializedData.Map[x, y].Z; newMap[x, y].RealY = serializedData.Map[x, y].RealY; if (serializedData.Map[x, y].MaterialName != null && serializedData.Map[x, y].MaterialName != "") { if (materials.ContainsKey(serializedData.Map[x, y].MaterialName)) { newMap[x, y].Material = materials[serializedData.Map[x, y].MaterialName]; } else { Debug.Log("Deserialization error, material " + serializedData.Map[x, y].MaterialName + " not found"); } } if (serializedData.Map[x, y].FillerName != null && serializedData.Map[x, y].FillerName != "") { if (materials.ContainsKey(serializedData.Map[x, y].FillerName)) { newMap[x, y].Filler = materials[serializedData.Map[x, y].FillerName]; } else { Debug.Log("Deserialization error, material " + serializedData.Map[x, y].FillerName + " not found"); } } } } mapInfos.Map = newMap; } else { mapInfos.Map = null; } return(mapInfos); }
public static MapInfosSerializable Serialize(MapInfos mapInfos) { MapInfosSerializable serializedData = new MapInfosSerializable(); serializedData.MapDataType = (MapDataType)System.Enum.Parse(typeof(MapDataType), mapInfos.MapData.name); serializedData.SizeX = (int)mapInfos.Size.x; serializedData.SizeY = (int)mapInfos.Size.y; serializedData.Layout = mapInfos.Layout; if (mapInfos.Map != null) { serializedData.Materials = new List <string>(); CellSerializable[,] serializedMap = new CellSerializable[serializedData.SizeX, serializedData.SizeY]; for (int x = 0; x < serializedData.SizeX; x++) { for (int y = 0; y < serializedData.SizeY; y++) { serializedMap[x, y] = new CellSerializable(); if (mapInfos.Map[x, y].IsTaken != null) { serializedMap[x, y].UnitId = mapInfos.Map[x, y].IsTaken.Id; } else { serializedMap[x, y].UnitId = -1; } serializedMap[x, y].IsWalkable = mapInfos.Map[x, y].IsWalkable; serializedMap[x, y].X = mapInfos.Map[x, y].X; serializedMap[x, y].Y = mapInfos.Map[x, y].Y; serializedMap[x, y].Z = mapInfos.Map[x, y].Z; serializedMap[x, y].RealY = mapInfos.Map[x, y].RealY; if (mapInfos.Map[x, y].Material != null) { serializedMap[x, y].MaterialName = mapInfos.Map[x, y].Material.name; if (!serializedData.Materials.Contains(serializedMap[x, y].MaterialName)) { serializedData.Materials.Add(serializedMap[x, y].MaterialName); } } if (mapInfos.Map[x, y].Filler != null) { serializedMap[x, y].FillerName = mapInfos.Map[x, y].Filler.name; if (!serializedData.Materials.Contains(serializedMap[x, y].FillerName)) { serializedData.Materials.Add(serializedMap[x, y].FillerName); } } } } serializedData.Map = serializedMap; } else { serializedData.Map = null; } return(serializedData); }
public DialogNewMapControl(MapInfos mapInfos) { Model = mapInfos; PreviousWidth = Model.Width; PreviousHeight = Model.Height; }
// ------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------- public DialogNewMapControl() { Model = new MapInfos(WANOK.GenerateMapName(), DEFAULT_SIZE, DEFAULT_SIZE); }
public void GenerateMaps(MapInfos mapInfos) { GenerateMap(mapInfos); GenerateClickableMap(mapInfos); }
// To save a map private void MenuFileNew_Save(object sender, RoutedEventArgs e) { // Popup to select the location of the file System.Windows.Forms.SaveFileDialog saveFilePopup = new System.Windows.Forms.SaveFileDialog(); string savePath; if (String.IsNullOrEmpty(lastSavePath)) { saveFilePopup.DefaultExt = ".json"; saveFilePopup.Filter = "JSON documents (.json)|*.json"; saveFilePopup.Title = "Save your map"; saveFilePopup.FileName = removeSpecialCharacters(mapName); if (saveFilePopup.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { cancelExit = true; return; } } if (saveFilePopup.FileName != "" || !String.IsNullOrEmpty(lastSavePath)) { savePath = (saveFilePopup.FileName != "" ? saveFilePopup.FileName : lastSavePath); Dictionary<int, List<tile>> sortedBlockTileList = new Dictionary<int, List<tile>>(); Dictionary<int, List<tile>> sortedPlayerTileList = new Dictionary<int, List<tile>>(); Dictionary<int, List<tile>> sortedEnemyTileList = new Dictionary<int, List<tile>>(); List<tile> heatZoneTileList = new List<tile>(); List<tile> otherTileList = new List<tile>(); // Handle the saving of heatzones tiles and null with properties tiles for (int j = 0; j < mapHeight; j++) { for (int i = 0; i < mapWidth; i++) { if (globalMap[i, j] != null) { tile specialTile = new tile { coordx = i, coordy = j, collidable = globalMap[i, j].collidable, properties = globalMap[i, j].properties }; if (globalMap[i, j].heatZone == true) heatZoneTileList.Add(specialTile); else { if (globalMap[i, j].properties != null && globalMap[i, j].tileSprite == null) otherTileList.Add(specialTile); } } } } // Saving of all the tiles with sprites for (int k = 0; k < listSprites.Count; k++) { List<tile> blockTileList = new List<tile>(); List<tile> playerTileList = new List<tile>(); List<tile> enemyTileList = new List<tile>(); for (int j = 0; j < mapHeight; j++) { for (int i = 0; i < mapWidth; i++) { if (globalMap[i, j] != null) { if (globalMap[i, j].tileSprite != null) { if (globalMap[i, j].tileSprite.ImageSource == listSprites[k].ImageSource) { if (globalMap[i, j].spriteType == SpriteType.BLOCK) blockTileList.Add(new tile() { coordx = i, coordy = j, collidable = globalMap[i, j].collidable, properties = globalMap[i, j].properties }); else if (globalMap[i, j].spriteType == SpriteType.PLAYER) playerTileList.Add(new tile() { coordx = i, coordy = j, collidable = globalMap[i, j].collidable, properties = globalMap[i, j].properties }); else if (globalMap[i, j].spriteType == SpriteType.ENEMY) enemyTileList.Add(new tile() { coordx = i, coordy = j, collidable = globalMap[i, j].collidable, properties = globalMap[i, j].properties }); } else { if (usedBlockSprites.ContainsKey(k)) if (globalMap[i, j].tileSprite == usedBlockSprites[k]) if (globalMap[i, j].spriteType == SpriteType.BLOCK) blockTileList.Add(new tile() { coordx = i, coordy = j, collidable = globalMap[i, j].collidable, properties = globalMap[i, j].properties }); if (usedPlayerSprites.ContainsKey(k - defaultSpriteSheetSize)) if (globalMap[i, j].tileSprite == usedPlayerSprites[k - defaultSpriteSheetSize]) if (globalMap[i, j].spriteType == SpriteType.PLAYER) playerTileList.Add(new tile() { coordx = i, coordy = j, collidable = globalMap[i, j].collidable, properties = globalMap[i, j].properties }); if (usedEnemySprites.ContainsKey(k - defaultSpriteSheetSize - playerSpriteSheetSize)) if (globalMap[i, j].tileSprite == usedEnemySprites[k - defaultSpriteSheetSize - playerSpriteSheetSize]) if (globalMap[i, j].spriteType == SpriteType.ENEMY) enemyTileList.Add(new tile() { coordx = i, coordy = j, collidable = globalMap[i, j].collidable, properties = globalMap[i, j].properties }); } } } } } if (blockTileList.Count != 0) sortedBlockTileList.Add(k, blockTileList); if (playerTileList.Count != 0) sortedPlayerTileList.Add(k - defaultSpriteSheetSize, playerTileList); if (enemyTileList.Count != 0) sortedEnemyTileList.Add(k - defaultSpriteSheetSize - playerSpriteSheetSize, enemyTileList); } MapInfos map = new MapInfos(); map.name = mapName; map.size = mapWidth + "/" + mapHeight; map.audio = mapAudioPath; map.background = mapBackgroundPath; map.blockTileList = sortedBlockTileList; map.playerTileList = sortedPlayerTileList; map.enemyTileList = sortedEnemyTileList; map.heatZonesList = heatZoneTileList; map.otherTileList = otherTileList; string json = JsonConvert.SerializeObject(map, Formatting.Indented); File.WriteAllText(savePath, json); lastSavePath = savePath; hasBeenModified = false; } }
public static IEnumerator GetIntoDaMap(string call, object[] neededArgs) { if (GameObject.Find("Main Camera OW")) { GameObject.Find("Main Camera OW").GetComponent <EventManager>().readyToReLaunch = true; GameObject.Find("Main Camera OW").tag = "MainCamera"; } //Clear any leftover Sprite and Text objects that are no longer connected to any scripts foreach (Transform child in GameObject.Find("Canvas Two").transform) { if (!child.name.EndsWith("Layer")) { GameObject.Destroy(child.gameObject); } else { foreach (Transform child2 in child) { GameObject.Destroy(child2.gameObject); } } } yield return(0); Camera.main.transparencySortMode = TransparencySortMode.CustomAxis; Camera.main.transparencySortAxis = new Vector3(0.0f, 1.0f, 1000000.0f); try { PlayerOverworld.instance.backgroundSize = GameObject.Find("Background").GetComponent <RectTransform>().sizeDelta *GameObject.Find("Background").GetComponent <RectTransform>().localScale.x; } catch { UnitaleUtil.WriteInLogAndDebugger("RectifyCameraPosition: The 'Background' GameObject is missing."); } EventManager.instance.onceReload = false; //Permits to reload the current data if needed MapInfos mi = GameObject.Find("Background").GetComponent <MapInfos>(); if (StaticInits.MODFOLDER != mi.modToLoad) { StaticInits.MODFOLDER = mi.modToLoad; StaticInits.Initialized = false; StaticInits.InitAll(); LuaScriptBinder.Set(null, "ModFolder", DynValue.NewString(StaticInits.MODFOLDER)); if (call == "transitionoverworld") { EventManager.instance.ScriptLaunched = false; EventManager.instance.script = null; } } AudioSource audio = UnitaleUtil.GetCurrentOverworldAudio(); if (mi.isMusicKeptBetweenBattles) { Camera.main.GetComponent <AudioSource>().Stop(); Camera.main.GetComponent <AudioSource>().clip = null; } else { PlayerOverworld.audioKept.Stop(); PlayerOverworld.audioKept.clip = null; } //Starts the music if there's no music if (audio.clip == null) { if (mi.music != "none") { audio.clip = AudioClipRegistry.GetMusic(mi.music); audio.time = 0; audio.Play(); } else { audio.Stop(); } } else { //Get the file's name with this...thing? string test = audio.clip.name.Replace('\\', '/').Split(new string[] { "/Audio/" }, System.StringSplitOptions.RemoveEmptyEntries)[1].Split('.')[0]; if (test != mi.music) { if (mi.music != "none") { audio.clip = AudioClipRegistry.GetMusic(mi.music); audio.time = 0; audio.Play(); } else { audio.Stop(); } } } GameObject.Find("utHeart").GetComponent <Image>().color = new Color(GameObject.Find("utHeart").GetComponent <Image>().color.r, GameObject.Find("utHeart").GetComponent <Image>().color.g, GameObject.Find("utHeart").GetComponent <Image>().color.b, 0); PlayerOverworld.instance.cameraShift = Vector2.zero; if (call == "tphandler") { GameObject.Find("Player").transform.parent.position = (Vector2)neededArgs[0]; PlayerOverworld.instance.gameObject.GetComponent <CYFAnimator>().movementDirection = ((TPHandler)neededArgs[1]).direction; ((TPHandler)neededArgs[1]).activated = false; GameObject.Destroy(((TPHandler)neededArgs[1]).gameObject); } if (GameObject.Find("Don't show it again")) { GameObject.Destroy(GameObject.Find("Don't show it again")); } StaticInits.SendLoaded(); }