// Start is called before the first frame update void Start() { MPDataCreator creator = gameObject.GetComponent <MPDataCreator>(); if (creator != null) { string path = string.Format("{0}/MightyPillar/Resources/{1}.bytes", Application.dataPath, creator.DataName); PillarData data = MPFileUtil.LoadData(path, creator.DataName); data.setting.boundHeight = BoundHeight; data.setting.jumpableHeight = JumpableHeight; mPathPinder = new MPUnityAStar(data); } }
void PlaceTheChess(GuardianUIData guardian, Transform target) { if (placing && !guardian.Placed && target != null) { PillarData pData = target.GetComponent <PillarData>(); if (!pData.WithGuardian) { Transform newChess = Instantiate(guardian.ChessDisplay, target.transform.position, Quaternion.identity) as Transform; //newChess.Translate(new Vector3(0.0f,1.5f,0.0f)); pData.PlaceGuardian(guardian, newChess); pData.Display_Model = newChess; guardian.Placed = true; } } }
public void DrawPillar() { Pillar_w = float.Parse(Pillar_InputField_w.text); Pillar_h1 = float.Parse(Pillar_InputField_h1.text); Pillar_h2 = float.Parse(Pillar_InputField_h2.text); Pillar_jw = float.Parse(Pillar_InputField_jw.text); Pillar_jh = float.Parse(Pillar_InputField_jh.text); Pillar_slnum = int.Parse(Pillar_InputField_slnum.text); Pillar_gjposition = ConvertStrToVector3(Pillar_InputField_gjposition.text); Pillar_gjnum = int.Parse(Pillar_InputField_gjnum.text); CubeMeshData.yThickness = 0.5f * Pillar_jh; CubeMeshData.zThickness = 0.5f * Pillar_jw; foreach (Transform child in RLKUtility.Room_pillar.transform) { Destroy(child.gameObject); } Resources.UnloadUnusedAssets(); if (Pillar_slnum % 2 == 1 && Pillar_slnum < 9) { } else { Pillar_slnum = 9; } Debug.Log(Pillar_slnum); // PillarData p = new PillarData (12f,1f,2f); PillarData p = new PillarData(Pillar_w, Pillar_h1, Pillar_h2); if (Pillar_slnum == 9) { // p.draw (); p.drawByNum(Pillar_slnum); } else { p.drawByNum(Pillar_slnum); } }
public void Serialize(EnchantmentRecipe recipe, Enchantment enchantment) { Name = enchantment.Name; RecipeID = recipe.RecipeID; TimeOfDay = recipe.TimeOfDay; Temperatures = recipe.Temperature; WindAltarActivated = recipe.WindAltarActivated; Regions = recipe.Region; if (recipe.QuestEvent?.Event != null) { var qEvt = recipe.QuestEvent.Event; QuestEvent = qEvt.EventName + " (" + qEvt.Description + ")"; } CompatibleEquipment = new EquipmentData(); if (recipe.CompatibleEquipments.EquipmentTag != null && recipe.CompatibleEquipments.EquipmentTag.Tag != Tag.None) { CompatibleEquipment.EquipmentTag = recipe.CompatibleEquipments.EquipmentTag.Tag.TagName; } if (recipe.CompatibleEquipments.CompatibleEquipments != null) { var list = new List <IngredientData>(); foreach (var equip in recipe.CompatibleEquipments.CompatibleEquipments) { var data = new IngredientData { Type = equip.Type }; if (equip.Type == EnchantmentRecipe.IngredientData.IngredientType.Generic) { data.IngredientTag = equip.IngredientTag.Tag.TagName; } else { data.SpecificItemID = equip.SpecificIngredient.ItemID; } list.Add(data); } CompatibleEquipment.CompatibleEquipments = list.ToArray(); } if (recipe.PillarDatas != null) { var list = new List <PillarData>(); foreach (var pillarData in recipe.PillarDatas) { var pillar = new PillarData { Direction = pillarData.Direction, IsFar = pillarData.IsFar, }; var ingList = new List <IngredientData>(); foreach (var ingredient in pillarData.CompatibleIngredients) { var ing = new IngredientData { Type = ingredient.Type, }; if (ingredient.Type == EnchantmentRecipe.IngredientData.IngredientType.Generic) { ing.IngredientTag = ingredient.IngredientTag.Tag.TagName; } else { ing.SpecificItemID = ingredient.SpecificIngredient.ItemID; } ingList.Add(ing); } pillar.CompatibleIngredients = ingList.ToArray(); list.Add(pillar); } PillarDatas = list.ToArray(); } if (recipe.Weather != null) { var weatherList = new List <WeatherCondition>(); foreach (var weather in recipe.Weather) { weatherList.Add(new WeatherCondition { Invert = weather.Invert, WeatherType = weather.Weather }); } Weather = weatherList.ToArray(); } Result = DM_Enchantment.ParseEnchantment(enchantment); }
// ================================================================ // // 방을 만든다. // 방을 만든다. public RoomController createRoom(Map.RoomIndex room_index) { Vector3 room_center = Vector3.zero; Vector3 position = Vector3.zero; int n = 0; // ---------------------------------------------------------------- // // 방 관리 오브젝트를 만든다. RoomController room = this.get_room_root_go(room_index); room_center = this.getRoomCenterPosition(room_index); room.transform.position = room_center; // ---------------------------------------------------------------- // // 마루를 만든다. GameObject floors = new GameObject("floors"); floors.transform.position = room_center; room.floor_objects = new GameObject[this.block_grid_columns_num, this.block_grid_rows_num]; foreach(var bi in Map.BlockIndex.getRange(this.block_grid_columns_num, this.block_grid_rows_num)) { GameObject prefab = this.floor_prefabs[(bi.x + bi.z)%this.floor_prefabs.Length]; GameObject go = GameObject.Instantiate(prefab) as GameObject; position = this.getBlockCenterPosition(bi); position += room_center; go.transform.position = position; go.transform.parent = floors.transform; room.floor_objects[bi.x, bi.z] = go; } // ---------------------------------------------------------------- // // 방 이동 문을 만든다. List<DoorData> door_datas = new List<DoorData>(); // 플로어 우단 방이 아니면……. if(room_index.x < ROOM_COLUMNS_NUM - 1) { for(int bz = 0; bz < this.block_rows_num; bz++) { int bx = this.block_columns_num - 1; if (this.level_data[room_index.x, room_index.z][bx, bz] == FieldGenerator.ChipType.Door) { // 좌:우의 방을 연결하는 문. DoorData data = new DoorData(); data.type = DoorControl.TYPE.ROOM; data.room0 = room_index; data.room1 = room_index.get_next(1, 0); data.local_position = bz/2; door_datas.Add(data); } } } // 플로어 상단 방이 아니라면……. if(room_index.z < ROOM_ROWS_NUM - 1) { for(int bx = 0; bx < this.block_columns_num; bx++) { int bz = this.block_rows_num - 1; if (this.level_data[room_index.x, room_index.z][bx, bz] == FieldGenerator.ChipType.Door) { // 하:상의 방을 연결하는 문. DoorData data = new DoorData(); data.type = DoorControl.TYPE.ROOM; data.room0 = room_index; data.room1 = room_index.get_next(0, 1); data.local_position = bx/2; door_datas.Add(data); } } } this.create_doors(door_datas); // ---------------------------------------------------------------- // // 방 내벽을 만든다. List<InnerWallData> wall_datas = new List<InnerWallData>(); // 우벽 등록. for(int bz = 1;bz < this.block_rows_num;bz+=2) { for(int bx = 2;bx < this.block_columns_num - 2;bx+=2) { // 벽인지 조사한다. if(this.level_data[room_index.x, room_index.z][bx, bz] == FieldGenerator.ChipType.Wall) { InnerWallData data = new InnerWallData(); data.x = (bx - 2) / 2; data.z = (bz - 1) / 2; data.is_horizontal = false; // 세로 벽. wall_datas.Add(data); } } } // 상벽 등록. for(int bx = 1;bx < this.block_columns_num;bx+=2) { for(int bz = 2;bz < this.block_rows_num - 2;bz+=2) { // 벽인지 조사한다. if(this.level_data[room_index.x, room_index.z][bx, bz] == FieldGenerator.ChipType.Wall) { InnerWallData data = new InnerWallData(); data.x = (bx - 1) / 2; data.z = (bz - 2) / 2; data.is_horizontal = true; // 가로벽. wall_datas.Add(data); } } } this.create_inner_wall(room_index, wall_datas); // ---------------------------------------------------------------- // // 기둥을 만든다. // 벽이 두 장이상 접해 있는 부분에 만든다. List<PillarData> pillar_datas = new List<PillarData>(); PillarData pillar_data = new PillarData(); for(int x = 0;x < BLOCK_GRID_COLUMNS_NUM - 1;x++) { for(int z = 0;z < BLOCK_GRID_ROWS_NUM - 1;z++) { n = 0; // 좌. if(wall_datas.Exists(wall => (wall.is_horizontal && wall.x == x && wall.z == z))) { n++; } // 우. if(wall_datas.Exists(wall => (wall.is_horizontal && wall.x == x + 1 && wall.z == z))) { n++; } // 하. if(wall_datas.Exists(wall => (!wall.is_horizontal && wall.x == x && wall.z == z))) { n++; } // 상. if(wall_datas.Exists(wall => (!wall.is_horizontal && wall.x == x && wall.z == z + 1))) { n++; } if(n < 2) { continue; } pillar_data.x = x; pillar_data.z = z; pillar_datas.Add(pillar_data); } } this.create_pillar(room_index, pillar_datas); // ---------------------------------------------------------------- // floors.transform.parent = room.transform; return(room.GetComponent<RoomController>()); }
// ======== Serializing Enchantment into a Template ========= public static SL_EnchantmentRecipe SerializeEnchantment(EnchantmentRecipe recipe) { var enchantment = ResourcesPrefabManager.Instance.GetEnchantmentPrefab(recipe.ResultID); var template = new SL_EnchantmentRecipe { Name = enchantment.Name, Description = enchantment.Description, EnchantmentID = recipe.RecipeID, IncenseItemID = recipe.PillarDatas?[0]?.CompatibleIngredients?[0].SpecificIngredient?.ItemID ?? -1, TimeOfDay = recipe.TimeOfDay, Areas = recipe.Region, Temperature = recipe.Temperature, WindAltarActivated = recipe.WindAltarActivated, IsEnchantingGuildRecipe = recipe.TableIsInBuilding, EnchantTime = enchantment.EnchantTime, HealthAbsorbRatio = enchantment.HealthAbsorbRatio, StaminaAbsorbRatio = enchantment.StaminaAbsorbRatio, ManaAbsorbRatio = enchantment.ManaAbsorbRatio, Indestructible = enchantment.Indestructible, TrackDamageRatio = enchantment.TrackDamageRatio }; if (recipe.PillarDatas != null) { var pillarList = new List <PillarData>(); foreach (var pillarData in recipe.PillarDatas) { var data = new PillarData { Direction = (Directions)pillarData.Direction, IsFar = pillarData.IsFar, }; pillarList.Add(data); } template.PillarDatas = pillarList.ToArray(); } var compatibleEquipment = new EquipmentData { RequiredTag = recipe.CompatibleEquipments.EquipmentTag.Tag.TagName }; if (recipe.CompatibleEquipments.CompatibleEquipments != null) { var equipList = new List <IngredientData>(); foreach (var equipData in recipe.CompatibleEquipments.CompatibleEquipments) { var data = new IngredientData { SelectorType = (IngredientTypes)equipData.Type }; if (data.SelectorType == IngredientTypes.SpecificItem) { data.SelectorValue = equipData.SpecificIngredient?.ItemID.ToString(); } else { data.SelectorValue = equipData.IngredientTag.Tag.TagName; } equipList.Add(data); } compatibleEquipment.Equipments = equipList.ToArray(); } template.CompatibleEquipment = compatibleEquipment; // Parse the actual Enchantment effects if (enchantment.transform.childCount > 0) { var effects = new List <SL_EffectTransform>(); foreach (Transform child in enchantment.transform) { var effectsChild = SL_EffectTransform.ParseTransform(child); if (effectsChild.HasContent) { effects.Add(effectsChild); } } template.Effects = effects.ToArray(); } if (enchantment.AdditionalDamages != null) { var list = new List <AdditionalDamage>(); foreach (var addedDmg in enchantment.AdditionalDamages) { list.Add(new AdditionalDamage { AddedDamageType = addedDmg.BonusDamageType, ConversionRatio = addedDmg.ConversionRatio, SourceDamageType = addedDmg.SourceDamageType }); } template.AddedDamages = list.ToArray(); } if (enchantment.StatModifications != null) { var list = new List <StatModification>(); foreach (var statMod in enchantment.StatModifications) { list.Add(new StatModification { Stat = statMod.Name, Type = statMod.Type, Value = statMod.Value }); } template.StatModifications = list.ToArray(); } if (enchantment.DamageBonus != null) { template.FlatDamageAdded = SL_Damage.ParseDamageList(enchantment.DamageBonus).ToArray(); } if (enchantment.DamageModifier != null) { template.DamageModifierBonus = SL_Damage.ParseDamageList(enchantment.DamageModifier).ToArray(); } if (enchantment.ElementalResistances != null) { template.DamageResistanceBonus = SL_Damage.ParseDamageList(enchantment.ElementalResistances).ToArray(); } template.GlobalStatusResistance = enchantment.GlobalStatusResistance; return(template); }