//формирование списка текстур земли public static string[] GetTilesList(Util.Map.Location map) { string[] textures = new string[0]; switch (map) { case Util.Map.Location.Lorencia: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround02", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02" }; break; case Util.Map.Location.Dungeun: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround02", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02" }; break; case Util.Map.Location.Devias: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround02", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04", "TileRock05", "TileRock06", "TileRock07" }; break; case Util.Map.Location.Noria: textures = new string[] { "TileGrass01", "TileGrass01", "TileGround01", "TileGround01", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04" }; break; case Util.Map.Location.LostTower: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround02", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04" }; break; case Util.Map.Location.DareDevil: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround02", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04", "TileRock05", "TileRock06", "TileRock07" }; break; case Util.Map.Location.Stadium: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround02", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04" }; break; case Util.Map.Location.Atlans: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround01", "TileGround03", "TileGrass01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04" }; break; case Util.Map.Location.Tarcan: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround02", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04" }; break; case Util.Map.Location.DevilSquare: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround01", "TileGround01", "TileGround03", "TileGrass01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04" }; break; case Util.Map.Location.BloodCastle: textures = new string[] { "TileGrass01", "TileGrass02", "TileGround02", "TileGround02", "TileGround03", "TileWater01", "TileWood01", "TileRock01", "TileRock02", "TileRock03", "TileRock04" }; break; case Util.Map.Location.Icarus: textures = new string[] { "TileGrass01", "TileGrass01", "TileGrass01", "TileGrass01", "TileGrass01", "TileGrass01", "TileGrass01", "TileGrass01", "TileGrass01", "TileGrass01", "TileRock04" }; break; } return(textures); }
SplatPrototype[] GetPrototypes() { Util.Map.Location map = global.map; string[] textures = WorldConfig.GetTilesList(map); if (textures.Length == 0) { return(new SplatPrototype[0]); } string dir = Util.File.WorldStorageDir(map); SplatPrototype[] array = new SplatPrototype[textures.Length + 1]; for (int i = 0; i < textures.Length; ++i) { if (textures[i] == null) { array[i] = new SplatPrototype(); } else { array[i] = GetSplat(Util.File.DIRECTORY_DATA + dir + "/" + textures[i] + ".jpg"); } } //simple texture from settings array[textures.Length] = new SplatPrototype(); array[textures.Length].texture = Util.Data.CreateFillTexture(WorldConfig.GetBackground(map), 256, 256); array[textures.Length].tileSize = new Vector2(Config.TileSize, Config.TileSize); return(array); }
public MapDataObjects(Util.Map.Location map) { this.map = map; this.file = WorldConfig.FILE_OBJECT; byte[] bytes = Load(); if (bytes != null) { Parse(bytes); } }
public MapDataHeight(Util.Map.Location map) { this.map = map; this.file = WorldConfig.FILE_HEIGHT; byte[] bytes = Load(); if (bytes != null) { Parse(bytes); } }
//папка объектов public static string ObjectsStorageDir(Util.Map.Location map) { string dir = ""; int i = (int)map; if (i != 0) { dir = "Object" + i.ToString() + "/"; } return(dir); }
//папка мира public static string WorldStorageDir(Util.Map.Location map) { string dir = ""; int i = (int)map; if (i != 0) { dir = "World" + i.ToString(); } return(dir); }
public MapDataGround(Util.Map.Location map) { this.map = map; this.file = WorldConfig.FILE_GROUND; byte[] bytes = Load(); if (bytes != null) { Parse(bytes); } }
public MapDataZones(Util.Map.Location map) { this.map = map; this.file = WorldConfig.FILE_ZONE; byte[] bytes = Load(); if (bytes != null) { Parse(bytes); } }
public void Init(Util.Map.Location map) { this.map = map; area = gameObject.AddComponent<AudioSource>(); area.loop = true; if (WorldConfig.GetWindSound(map)) { wind = Util.Audio.GetLoopSource (gameObject, Sounds.Area.Wind); } }
public static Color GetBackground(Util.Map.Location map) { Color color = Color.black; switch (map) { case Util.Map.Location.Devias: color = Color.white; break; case Util.Map.Location.Icarus: color = new Color(0.4f, 0.6f, 0.9f, 1f); break; } return(color); }
public void Init(Util.Map.Location map) { this.map = map; area = gameObject.AddComponent <AudioSource>(); area.loop = true; if (WorldConfig.GetWindSound(map)) { wind = Util.Audio.GetLoopSource(gameObject, Sounds.Area.Wind); } }
public void Init(Util.Map.Location map) { LightmapData[] lightmapData = new LightmapData[1]; LightmapSettings.lightmapsMode = LightmapsMode.Single; for (int i = 0; i < 1; i++) { lightmapData[i] = new LightmapData(); lightmapData[i].lightmapFar = Resources.Load(Util.File.DIRECTORY_LIGHTS + (int)map, typeof(Texture2D)) as Texture2D; } LightmapSettings.lightmaps = lightmapData; }
//звук ветра public static bool GetWindSound(Util.Map.Location map) { bool wind = false; switch (map) { case Util.Map.Location.Lorencia: case Util.Map.Location.Devias: case Util.Map.Location.Noria: wind = true; break; } return(wind); }
//список спец предметов public static int[] GetSpecialObjects(Util.Map.Location map) { int[] objects = new int[0]; switch (map) { case Util.Map.Location.Lorencia: objects = new int[] { 1, 61, 91 }; break; case Util.Map.Location.Dungeun: objects = new int[] { 61 }; break; case Util.Map.Location.LostTower: objects = new int[] { 41 }; break; case Util.Map.Location.Stadium: objects = new int[] { 65022 }; break; } return(objects); }
//основной повторяющий звук public static Sounds.Area GetLoopSound(Util.Map.Location map) { Sounds.Area sound = Sounds.Area.Wind; switch (map) { //case Util.Map.Location.Lorencia: sound = Sounds.Area.Rain; break; case Util.Map.Location.Dungeun: sound = Sounds.Area.Dungeon; break; case Util.Map.Location.Atlans: sound = Sounds.Area.Water; break; case Util.Map.Location.LostTower: sound = Sounds.Area.Tower; break; case Util.Map.Location.Tarcan: sound = Sounds.Area.Desert; break; } return(sound); }
//привязка компонентов к предметам public static Type GetAIObjects(Util.Map.Location map, int id) { Type component = null; switch (map) { case Util.Map.Location.Atlans: switch (id) { case 24: component = typeof(MuMap.AI.AtlansDoor); break; } break; case Util.Map.Location.Devias: switch (id) { case 21: case 89: component = typeof(MuMap.AI.SimpleDoor); break; case 87: component = typeof(MuMap.AI.GateDoor); break; case 82: case 83: case 99: case 100: component = typeof(MuMap.AI.Roof); break; } break; case Util.Map.Location.Lorencia: switch (id) { case 126: case 127: component = typeof(MuMap.AI.Roof); break; } break; } return(component); }
//возвращает тестовые стартовые координаты public static MuCoord TestMyCoord(Util.Map.Location map) { MuCoord coord = new MuCoord(); switch (map) { case Util.Map.Location.Lorencia: coord = new MuCoord() { x = 135, y = 128 }; break; case Util.Map.Location.Devias: coord = new MuCoord() { x = 218, y = 34 }; break; case Util.Map.Location.Noria: coord = new MuCoord() { x = 173, y = 110 }; break; case Util.Map.Location.Dungeun: coord = new MuCoord() { x = 109, y = 247 }; break; case Util.Map.Location.Atlans: coord = new MuCoord() { x = 21, y = 14 }; break; case Util.Map.Location.LostTower: coord = new MuCoord() { x = 165, y = 168 }; break; case Util.Map.Location.Stadium: coord = new MuCoord() { x = 60, y = 108 }; break; case Util.Map.Location.Tarcan: coord = new MuCoord() { x = 130, y = 50 }; break; case Util.Map.Location.BloodCastle: coord = new MuCoord() { x = 15, y = 15 }; break; case Util.Map.Location.DevilSquare: coord = new MuCoord() { x = 70, y = 100 }; break; } return(coord); }
//проверяет зону на плавательную public static bool isSwimZone(Util.Map.Location map) { return(map == Util.Map.Location.Atlans); }
//трава public static Grass[] GetDetailsList(Util.Map.Location map) { Grass[] textures = new Grass[0]; switch (map) { case Util.Map.Location.Lorencia: textures = new Grass[] { new Grass() { file = "TileGrass01", dry = Color.yellow, healthy = Color.green, minHeight = 100, maxHeight = 120 } }; break; case Util.Map.Location.Devias: textures = new Grass[] { new Grass() { file = "TileGrass02", dry = Color.white, healthy = Color.white, minHeight = 50, maxHeight = 100 }, new Grass() { file = "TileGrass02", dry = Color.white, healthy = Color.white, minHeight = 50, maxHeight = 100 } }; break; case Util.Map.Location.Noria: textures = new Grass[] { new Grass() { file = "TileGrass01", dry = Color.yellow, healthy = Color.green, minHeight = 150, maxHeight = 200 }, null, new Grass() { file = "TileGrass03", dry = Color.yellow, healthy = Color.yellow, minHeight = 200, maxHeight = 300 } }; break; case Util.Map.Location.DareDevil: textures = new Grass[] { new Grass() { file = "TileGrass01", dry = Color.yellow, healthy = Color.yellow, minHeight = 150, maxHeight = 200 }, new Grass() { file = "TileGrass02", dry = Color.white, healthy = Color.white, minHeight = 150, maxHeight = 200 }, new Grass() { file = "TileGrass03", dry = Color.yellow, healthy = Color.yellow, minHeight = 200, maxHeight = 300 } }; break; case Util.Map.Location.Stadium: textures = new Grass[] { new Grass() { file = "TileGrass01", dry = Color.yellow, healthy = Color.yellow, minHeight = 100, maxHeight = 150 } }; break; case Util.Map.Location.Tarcan: textures = new Grass[] { new Grass() { file = "TileGrass01", dry = Color.gray, healthy = Color.gray, minHeight = 200, maxHeight = 300 }, null, new Grass() { file = "TileGrass03", dry = Color.yellow, healthy = Color.yellow, minHeight = 200, maxHeight = 300 } }; break; } return(textures); }
IEnumerator CreateWorldObject(GameObject xy, MapObject mapObject) { if (mapObject.isSpecial) { yield break; //временно не добавляем спецобъекты } Util.Map.Location map = global.map; string dir = Util.File.ObjectsStorageDir(map); string file = dir + "Object" + mapObject.id.ToString(); string contr = dir + "Controller" + mapObject.id.ToString(); GameObject obj = Util.Storage.LoadPrefab(file); GameObject muObject = null; if (obj != null) { muObject = (GameObject)Instantiate(obj, Vector3.zero, Quaternion.identity); muObject.name = "Obj" + mapObject.id.ToString(); Transform SMD = muObject.transform.FindChild("SMDImport"); if (SMD != null) { SkinnedMeshRenderer mesh = SMD.gameObject.GetComponent <SkinnedMeshRenderer>(); if (mesh != null) { mesh.castShadows = mesh.receiveShadows = false; } } if (global.settings.AnimatedWorldObjects) { Util.GO.SetAnimator(muObject, contr); } Util.GO.SetParent(muObject.transform, xy.transform); Util.GO.SetLayer(muObject, Util.GO.Layer.WorldObjects); muObject.transform.position = mapObject.position; muObject.transform.localScale = new Vector3(mapObject.scale * Config.ScaleObject.x, mapObject.scale * Config.ScaleObject.y, mapObject.scale * Config.ScaleObject.z); muObject.transform.localRotation = Quaternion.Euler(mapObject.rotate); //добавляем AI на объект (если есть) System.Type type = WorldConfig.GetAIObjects(map, mapObject.id); if (type != null) { muObject.AddComponent(type); } muObject.isStatic = true; } else { if (Config.ErrorWorldObjectNotFound) { Debug.Log(Lang.str("ErrorCreateObject", file)); } } yield break; }