public int getChHp(string type, int lv, int pa_hp) { int returnValue = 0; if (lv == 0) { lv = 1; } Entity_lvch_mst stsMst = Resources.Load("Data/lvch_mst") as Entity_lvch_mst; int startline = 0; if (type == "YR") { startline = 1; } else if (type == "TP") { startline = 2; } else if (type == "YM") { startline = 3; } object stslst = stsMst.param[startline]; Type t = stslst.GetType(); String param = "lv" + lv; FieldInfo f = t.GetField(param); int sts = (int)f.GetValue(stslst); returnValue = sts + pa_hp / 2; return(returnValue); }
public int getChildStatus(int lv, string ch_type, int linkNo) { Entity_lvch_mst chLvMst = Resources.Load("Data/lvch_mst") as Entity_lvch_mst; int startline = 0; if (ch_type == "YR") { startline = 0; } else if (ch_type == "KB") { startline = 1; } else if (ch_type == "TP") { startline = 2; } else if (ch_type == "YM") { startline = 3; } object chStsLst = chLvMst.param[startline]; Type t = chStsLst.GetType(); string param = "lv" + lv; FieldInfo f = t.GetField(param); int ch_status = (int)f.GetValue(chStsLst); ch_status = ch_status * 10; //Adjustment if (linkNo != 0) { float linkAdjst = (float)linkNo / 10; float adjstSts = ch_status * linkAdjst; ch_status = ch_status + (int)adjstSts; } return(ch_status); }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); if (moneyOK != true) { //Error audioSources [4].Play(); msg.makeMessage(msg.getMessage(6)); } else { //OK audioSources [3].Play(); Slider lvSlider = GameObject.Find("KunrenSlider").GetComponent <Slider>(); int targetLv = (int)lvSlider.value; string payMoney = GameObject.Find("RequiredMoneyValue").GetComponent <Text>().text; string busyoId = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo; //reduce money int nowMoney = PlayerPrefs.GetInt("money"); int calcMoney = nowMoney - int.Parse(payMoney); //increase target Lv string tmp = "hei" + busyoId; string chParam = PlayerPrefs.GetString(tmp, "0"); if (chParam == "0" || chParam == "") { StatusGet statusScript = new StatusGet(); string chParamHeisyu = statusScript.getHeisyu(int.Parse(busyoId)); chParam = chParamHeisyu + ":1:1:1"; PlayerPrefs.SetString(tmp, chParam); PlayerPrefs.Flush(); } char[] delimiterChars = { ':' }; string[] ch_list = chParam.Split(delimiterChars); //get pure status Entity_lvch_mst lvMst = Resources.Load("Data/lvch_mst") as Entity_lvch_mst; int startline = 0; string ch_type = ch_list [0]; if (ch_type == "KB") { startline = 0; } else if (ch_type == "YR") { startline = 1; } else if (ch_type == "TP") { startline = 2; } else if (ch_type == "YM") { startline = 3; } object stslst = lvMst.param[startline]; Type t = stslst.GetType(); String param = "lv" + targetLv.ToString(); FieldInfo f = t.GetField(param); int sts = (int)f.GetValue(stslst); string newParam = ch_list [0] + ":" + ch_list [1] + ":" + targetLv.ToString() + ":" + sts.ToString(); PlayerPrefs.SetInt("money", calcMoney); PlayerPrefs.SetString(tmp, newParam); PlayerPrefs.SetBool("questDailyFlg23", true); PlayerPrefs.Flush(); //Message string busyoName = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName; string OKtext = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { OKtext = busyoName + " trained their soldiers."; } else { OKtext = busyoName + "隊にて訓練を実施しました。"; } msg.makeMessage(OKtext); //Reload //Close Board GameObject.Find("close").GetComponent <CloseBoard>().onClick(); RonkouScene ronkou = new RonkouScene(); ronkou.createBusyoStatusView(busyoId); } }
public void OnClick() { AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> (); audioSources [0].Play(); busyoName = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName; busyoId = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo; //commonPopup (); if (name == "kanjyo") { commonPopup(16); if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("popText").GetComponent <Text> ().text = "Certificate"; } else { GameObject.Find("popText").GetComponent <Text>().text = "感状授与"; } //Busyo View string path = "Prefabs/Player/Unit/BusyoUnit"; GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject; Busyo.name = busyoId.ToString(); Busyo.transform.SetParent(GameObject.Find("board(Clone)").transform); Busyo.transform.localScale = new Vector2(3, 3); Busyo.GetComponent <DragHandler>().enabled = false; RectTransform busyo_transform = Busyo.GetComponent <RectTransform>(); busyo_transform.anchoredPosition3D = new Vector3(300, 350, 0); busyo_transform.sizeDelta = new Vector2(100, 100); //Text Modification GameObject text = Busyo.transform.FindChild("Text").gameObject; text.GetComponent <Text> ().color = new Color(255, 255, 255, 255); RectTransform text_transform = text.GetComponent <RectTransform>(); text_transform.anchoredPosition3D = new Vector3(-70, 30, 0); text_transform.sizeDelta = new Vector2(630, 120); text.transform.localScale = new Vector2(0.2f, 0.2f); //Rank Text Modification GameObject rank = Busyo.transform.FindChild("Rank").gameObject; RectTransform rank_transform = rank.GetComponent <RectTransform>(); rank_transform.anchoredPosition3D = new Vector3(20, -50, 0); rank_transform.sizeDelta = new Vector2(200, 200); rank.GetComponent <Text>().fontSize = 200; //Common for Kanjyo string kanjyoPath = "Prefabs/Busyo/Kanjyo"; GameObject kanjyo = Instantiate(Resources.Load(kanjyoPath)) as GameObject; kanjyo.transform.SetParent(GameObject.Find("board(Clone)").transform); kanjyo.transform.localScale = new Vector2(1, 1); RectTransform kanjyo_transform = kanjyo.GetComponent <RectTransform>(); kanjyo_transform.anchoredPosition3D = new Vector3(0, 0, 0); //Busyo Lv GameObject.Find("PopLvValue").GetComponent <Text>().text = pa_lv.ToString(); //Exp Status Bar Exp exp = new Exp(); GameObject expSlider = GameObject.Find("ExpSlider"); int nextExp = exp.getDifExpforNextLv(pa_lv); string tempExp = "exp" + busyoId; int nowExp = PlayerPrefs.GetInt(tempExp); int startExp = nowExp - exp.getExpforNextLv(pa_lv - 1); expSlider.GetComponent <Slider>().maxValue = nextExp; expSlider.GetComponent <Slider>().value = (float)startExp; GameObject.Find("CurrentExpValue").GetComponent <Text>().text = startExp.ToString(); GameObject.Find("NextLvExpValue").GetComponent <Text>().text = nextExp.ToString(); Item item = new Item(); //Low kanjyo fields string kanjyoItemPath = "Prefabs/Item/Kanjyo/Kanjyo"; GameObject lowKanjyoItem = Instantiate(Resources.Load(kanjyoItemPath)) as GameObject; lowKanjyoItem.transform.SetParent(GameObject.Find("KakyuKanjyo").transform); lowKanjyoItem.transform.localScale = new Vector2(0.8f, 0.8f); RectTransform lowKanjyoTransform = lowKanjyoItem.GetComponent <RectTransform> (); lowKanjyoTransform.anchoredPosition3D = new Vector3(-210, 125, 0); lowKanjyoTransform.sizeDelta = new Vector2(100, 100); RectTransform lowKanjyoRank = lowKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <RectTransform>(); lowKanjyoRank.anchoredPosition3D = new Vector3(-30, 30, 0); RectTransform lowKanjyoRect = lowKanjyoItem.transform.FindChild("Kanjyo").GetComponent <RectTransform>(); lowKanjyoRect.sizeDelta = new Vector2(100, 100); Color lowColor = new Color(86f / 255f, 87f / 255f, 255f / 255f, 255f / 255f); lowKanjyoItem.GetComponent <Image>().color = lowColor; if (Application.systemLanguage != SystemLanguage.Japanese) { lowKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <Text>().text = "Low"; } else { lowKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <Text>().text = "下"; } lowKanjyoItem.name = "Kanjyo1"; //Item Effect int effectForLow = item.getEffect(lowKanjyoItem.name); GameObject.Find("KakyuKanjyoExpValue").GetComponent <Text>().text = effectForLow.ToString(); //Middle kanjyo fields GameObject midKanjyoItem = Instantiate(Resources.Load(kanjyoItemPath)) as GameObject; midKanjyoItem.transform.SetParent(GameObject.Find("CyukyuKanjyo").transform); midKanjyoItem.transform.localScale = new Vector2(0.8f, 0.8f); RectTransform midKanjyoTransform = midKanjyoItem.GetComponent <RectTransform> (); midKanjyoTransform.anchoredPosition3D = new Vector3(-210, 125, 0); midKanjyoTransform.sizeDelta = new Vector2(100, 100); RectTransform midKanjyoRank = midKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <RectTransform>(); midKanjyoRank.anchoredPosition3D = new Vector3(-30, 30, 0); RectTransform midKanjyoRect = midKanjyoItem.transform.FindChild("Kanjyo").GetComponent <RectTransform>(); midKanjyoRect.sizeDelta = new Vector2(100, 100); Color midColor = new Color(236f / 255f, 93f / 255f, 93f / 255f, 255f / 255f); midKanjyoItem.GetComponent <Image>().color = midColor; if (Application.systemLanguage != SystemLanguage.Japanese) { midKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <Text>().text = "Mid"; } else { midKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <Text>().text = "中"; } midKanjyoItem.name = "Kanjyo2"; //Item Effect int effectForMid = item.getEffect(midKanjyoItem.name); GameObject.Find("CyukyuKanjyoExpValue").GetComponent <Text>().text = effectForMid.ToString(); //Hight kanjyo fields GameObject highKanjyoItem = Instantiate(Resources.Load(kanjyoItemPath)) as GameObject; highKanjyoItem.transform.SetParent(GameObject.Find("JyokyuKanjyo").transform); highKanjyoItem.transform.localScale = new Vector2(0.8f, 0.8f); RectTransform hightKanjyoTransform = highKanjyoItem.GetComponent <RectTransform> (); hightKanjyoTransform.anchoredPosition3D = new Vector3(-210, 125, 0); hightKanjyoTransform.sizeDelta = new Vector2(100, 100); RectTransform highKanjyoRank = highKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <RectTransform>(); highKanjyoRank.anchoredPosition3D = new Vector3(-30, 30, 0); RectTransform highKanjyoRect = highKanjyoItem.transform.FindChild("Kanjyo").GetComponent <RectTransform>(); highKanjyoRect.sizeDelta = new Vector2(100, 100); Color hightColor = new Color(207f / 255f, 232f / 255f, 95f / 255f, 255f / 255f); highKanjyoItem.GetComponent <Image>().color = hightColor; if (Application.systemLanguage != SystemLanguage.Japanese) { highKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <Text>().text = "High"; } else { highKanjyoItem.transform.FindChild("KanjyoRank").GetComponent <Text>().text = "上"; } highKanjyoItem.name = "Kanjyo3"; //Item Effect int effectForHight = item.getEffect(highKanjyoItem.name); GameObject.Find("JyokyuKanjyoExpValue").GetComponent <Text>().text = effectForHight.ToString(); //Posessing QTY string kanjyoQtyString = PlayerPrefs.GetString("kanjyo"); char[] delimiterChars = { ',' }; string[] kanjyoList = kanjyoQtyString.Split(delimiterChars); GameObject.Find("KakyuKanjyoQtyValue").GetComponent <Text>().text = kanjyoList[0]; GameObject.Find("CyukyuKanjyoQtyValue").GetComponent <Text>().text = kanjyoList[1]; GameObject.Find("JyokyuKanjyoQtyValue").GetComponent <Text>().text = kanjyoList[2]; //Setting Value on Button GameObject.Find("DoKakyuKanjyo").GetComponent <DoKanjyo>().kanjyoList = kanjyoList; GameObject.Find("DoCyukyuKanjyo").GetComponent <DoKanjyo>().kanjyoList = kanjyoList; GameObject.Find("DoJyokyuKanjyo").GetComponent <DoKanjyo>().kanjyoList = kanjyoList; } else if (name == "ButtonCyouhei") { commonPopup(17); cyouheiView(ch_type); } else if (name == "ButtonKunren") { commonPopup(18); if (Application.systemLanguage != SystemLanguage.Japanese) { GameObject.Find("popText").GetComponent <Text> ().text = "Training"; } else { GameObject.Find("popText").GetComponent <Text>().text = "兵卒訓練"; } string chigyouPath = "Prefabs/Busyo/Kunren"; GameObject chigyo = Instantiate(Resources.Load(chigyouPath)) as GameObject; chigyo.transform.SetParent(GameObject.Find("board(Clone)").transform); chigyo.transform.localScale = new Vector2(1, 1); RectTransform chigyoTransform = chigyo.GetComponent <RectTransform> (); chigyoTransform.anchoredPosition3D = new Vector3(0, 0, 0); chigyo.name = "Kunren"; //Butai Name GameObject.Find("PopTextButaiName").GetComponent <Text>().text = busyoName + " " + ch_heisyu; string chPath = "Prefabs/Player/Unit/" + ch_type; GameObject chObj = Instantiate(Resources.Load(chPath)) as GameObject; chObj.transform.SetParent(GameObject.Find("Kunren").transform); chObj.transform.localScale = new Vector2(8, 8); RectTransform chTransform = chObj.GetComponent <RectTransform> (); chTransform.anchoredPosition3D = new Vector3(-260, 0, 0); //Butai Level GameObject.Find("LvFrom").GetComponent <Text>().text = ch_lv.ToString(); GameObject.Find("LvTo").GetComponent <Text>().text = (ch_lv + 1).ToString(); //Butai Status GameObject.Find("PopHpValue").GetComponent <Text>().text = ch_hp.ToString(); GameObject.Find("PopAtkValue").GetComponent <Text>().text = ch_status.ToString(); GameObject.Find("PopDfcValue").GetComponent <Text>().text = ch_status.ToString(); GameObject.Find("PopButaiNoValue").GetComponent <Text>().text = ch_num.ToString(); /* Slider Setting*/ //Required Money Entity_ch_exp_mst kunrenMst = Resources.Load("Data/ch_exp_mst") as Entity_ch_exp_mst; int MaxLv = 100; //Max - 1 int myMoney = PlayerPrefs.GetInt("money"); int totalMoney = 0; List <int> requredMoneyByLv = new List <int>(); //Slider Initial Setting Slider lvSlider = GameObject.Find("KunrenSlider").GetComponent <Slider>(); lvSlider.minValue = ch_lv + 1; lvSlider.value = ch_lv + 1; lvSlider.GetComponent <LvSlider>().toLv = GameObject.Find("LvTo"); lvSlider.GetComponent <LvSlider>().hp = GameObject.Find("PopHpValueUp"); lvSlider.GetComponent <LvSlider>().atk = GameObject.Find("PopAtkValueUp"); lvSlider.GetComponent <LvSlider>().dfc = GameObject.Find("PopDfcValueUp"); lvSlider.GetComponent <LvSlider>().requiredMoney = GameObject.Find("RequiredMoneyValue"); int limitLv = 0; //Lv100 Check int totalMoneyMax = kunrenMst.param[99].totalMoney; if (myMoney >= totalMoneyMax) { lvSlider.maxValue = 100; limitLv = 100; } else { //Check Limitation of Lv up & Money for (int k = ch_lv; k < MaxLv; k++) { int requiredMoney = kunrenMst.param[k].requiredMoney; totalMoney = totalMoney + requiredMoney; if (myMoney < totalMoney) { //Limitation of Lv up //Setup Slider Limitation lvSlider.maxValue = k; limitLv = k; break; } else { if (k == 99) { lvSlider.maxValue = 100; limitLv = 100; break; } } } } //Money List int paiedTotalMoney = kunrenMst.param[ch_lv - 1].totalMoney; for (int j = 0; j < 100; j++) { int totalRequiredMoney = kunrenMst.param[j].totalMoney - paiedTotalMoney; requredMoneyByLv.Add(totalRequiredMoney); } //Can Lvup if (limitLv != ch_lv) { //ChildStatusGet List <int> statusByLv = new List <int>(); Entity_lvch_mst lvMst = Resources.Load("Data/lvch_mst") as Entity_lvch_mst; int startline = 0; if (ch_type == "KB") { startline = 0; } else if (ch_type == "YR") { startline = 1; } else if (ch_type == "TP") { startline = 2; } else if (ch_type == "YM") { startline = 3; } object stslst = lvMst.param[startline]; Type t = stslst.GetType(); //for(int i=ch_lv+1; i<limitLv+1;i++) for (int i = 1; i < limitLv + 1; i++) { String param = "lv" + i; FieldInfo f = t.GetField(param); int sts = (int)f.GetValue(stslst); sts = sts + pa_hp / 2; statusByLv.Add(sts); } lvSlider.GetComponent <LvSlider>().moneyList = requredMoneyByLv; lvSlider.GetComponent <LvSlider>().statusList = statusByLv; lvSlider.GetComponent <LvSlider>().pa_hp = pa_hp; //Initial Setting GameObject.Find("RequiredMoneyValue").GetComponent <Text>().text = requredMoneyByLv[ch_lv].ToString(); GameObject.Find("PopHpValueUp").GetComponent <Text>().text = ((statusByLv[ch_lv] - pa_hp / 2) * 10).ToString(); GameObject.Find("PopAtkValueUp").GetComponent <Text>().text = statusByLv[ch_lv].ToString(); GameObject.Find("PopDfcValueUp").GetComponent <Text>().text = statusByLv[ch_lv].ToString(); } else { //Cannot Level up Case //disable slider lvSlider.value = ch_lv; GameObject.Find("KunrenSlider").GetComponent <Slider>().enabled = false; //Money Color shortageColor = new Color(203f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); Color greyColor = new Color(0f / 255f, 0f / 255f, 0f / 255f, 121f / 255f); GameObject rMoney = GameObject.Find("RequiredMoneyValue"); rMoney.GetComponent <Text>().text = totalMoney.ToString(); rMoney.GetComponent <Text>().color = shortageColor; //Lv GameObject.Find("LvTo").GetComponent <Text>().color = greyColor; //Next Lv Statu Entity_lvch_mst lvMst = Resources.Load("Data/lvch_mst") as Entity_lvch_mst; int startline = 0; if (ch_type == "KB") { startline = 0; } else if (ch_type == "YR") { startline = 1; } else if (ch_type == "TP") { startline = 2; } else if (ch_type == "YM") { startline = 3; } object stslst = lvMst.param[startline]; Type t = stslst.GetType(); int nextLv = ch_lv + 1; String param = "lv" + nextLv.ToString(); FieldInfo f = t.GetField(param); int sts = (int)f.GetValue(stslst); sts = sts + pa_hp / 2; GameObject hp = GameObject.Find("PopHpValueUp"); GameObject atk = GameObject.Find("PopAtkValueUp"); GameObject dfc = GameObject.Find("PopDfcValueUp"); hp.GetComponent <Text>().text = ((sts - pa_hp / 2) * 10).ToString(); hp.GetComponent <Text>().color = greyColor; atk.GetComponent <Text>().text = sts.ToString(); atk.GetComponent <Text>().color = greyColor; dfc.GetComponent <Text>().text = sts.ToString(); dfc.GetComponent <Text>().color = greyColor; GameObject.Find("GiveKunren").GetComponent <DoKunren>().moneyOK = false; } } }
/*make engun instance*/ public void makeEngunInstance(int busyoId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int ch_num, int ch_lv) { /*Parent Instantiate*/ string path = "Prefabs/Player/" + busyoId; GameObject prefab = Instantiate(Resources.Load(path)) as GameObject; prefab.name = busyoId.ToString(); //Senpou Script Parametor StatusGet senpouScript = new StatusGet(); bool onlySeaFlg = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]); if (!onlySeaFlg) { prefab.GetComponent <SenpouController>().senpouId = (int)senpouArray[0]; prefab.GetComponent <SenpouController>().senpouTyp = senpouArray[1].ToString(); prefab.GetComponent <SenpouController>().senpouName = senpouArray[2].ToString(); prefab.GetComponent <SenpouController>().senpouEach = (float)senpouArray[4]; prefab.GetComponent <SenpouController>().senpouRatio = (float)senpouArray[5]; prefab.GetComponent <SenpouController>().senpouTerm = (float)senpouArray[6]; prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7]; prefab.GetComponent <SenpouController>().senpouLv = (int)senpouArray[8]; //Serihu Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst; string serihu = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { serihu = serihuMst.param[busyoId - 1].senpouMsgEng; } else { serihu = serihuMst.param[busyoId - 1].senpouMsg; } prefab.GetComponent <SenpouController>().senpouSerihu = serihu; } else { Destroy(prefab.GetComponent <SenpouController>()); } //Engun Flg prefab.GetComponent <Kunkou> ().engunFlg = true; /*Player Status Setting*/ //parametor setting int adjHp = hp * 100; int adjAtk = atk * 10; int adjDfc = dfc * 10; //Busyo Detail Info [Name & HP Bar] string dtlPath = ""; if (Application.systemLanguage != SystemLanguage.Japanese) { dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng"; } else { dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer"; } GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject; dtl.transform.SetParent(prefab.transform); dtl.transform.localPosition = new Vector3(0, 1.3f, -1); dtl.transform.localScale = new Vector3(1.3f, 1.3f, 0); dtl.name = "BusyoDtlPlayer"; //Name GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject; nameLabel.GetComponent <TextMesh> ().text = busyoName; //HP Bar GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject; minHpBar.GetComponent <BusyoHPBar>().initLife = adjHp; //Location by map id prefab.transform.position = new Vector2(-20, -16); prefab.GetComponent <LineLocation>().nowLine = 5; //heisyu BusyoInfoGet info = new BusyoInfoGet(); string ch_type = info.getHeisyu(busyoId); prefab.GetComponent <PlayerHP> ().life = adjHp; //adjust spd float adjSpd = (float)spd / 10; if (prefab.GetComponent <PlayerAttack> ()) { prefab.GetComponent <PlayerAttack> ().attack = adjAtk; prefab.GetComponent <UnitMover> ().speed = adjSpd; } else { if (ch_type == "TP") { prefab.GetComponent <AttackLong> ().attack = 5 * adjAtk; } else if (ch_type == "YM") { prefab.GetComponent <AttackLong> ().attack = 3 * adjAtk; } prefab.GetComponent <UnitMover> ().speed = adjSpd; } prefab.GetComponent <PlayerHP>().dfc = adjDfc; prefab.GetComponent <UnitMover>().heisyu = ch_type; //SE AudioController audio = new AudioController(); audio.addComponentMoveAttack(prefab, ch_type); /*Child Instantiate*/ //set child object Entity_lvch_mst lvMst = Resources.Load("Data/lvch_mst") as Entity_lvch_mst; int startline = 0; if (ch_type == "KB") { startline = 0; } else if (ch_type == "YR") { startline = 1; } else if (ch_type == "TP") { startline = 2; } else if (ch_type == "YM") { startline = 3; } object stslst = lvMst.param[startline]; Type t = stslst.GetType(); String param = "lv" + ch_lv.ToString(); FieldInfo f = t.GetField(param); int sts = (int)f.GetValue(stslst); float ch_status = (float)sts; ch_status = ch_status * 10; string ch_path = "Prefabs/Player/" + ch_type; float y1 = 3.0f; float y2 = 3.0f; float y3 = 3.0f; float y4 = 3.0f; for (int i = 1; i <= ch_num; i++) { //Make Relationship GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject; ch_prefab.transform.parent = prefab.transform; ch_prefab.name = "Child" + i.ToString(); //Sashimono Making string sashimono_path = "Prefabs/Sashimono/" + busyoId; GameObject sashimono = Instantiate(Resources.Load(sashimono_path)) as GameObject; sashimono.transform.parent = ch_prefab.transform; sashimono.transform.localScale = new Vector2(0.3f, 0.3f); if (ch_type == "YR") { sashimono.transform.localPosition = new Vector2(-1, 0.6f); //Location if (i < 6) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 3, prefab.transform.position.y + y1); y1 = y1 - 1.5f; } else if (5 < i && i < 11) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 6, prefab.transform.position.y + y2); y2 = y2 - 1.5f; } else if (10 < i && i < 16) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 9, prefab.transform.position.y + y3); y3 = y3 - 1.5f; } else if (15 < i && i < 21) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 12, prefab.transform.position.y + y4); y4 = y4 - 1.5f; } } else if (ch_type == "KB") { sashimono.transform.localPosition = new Vector2(-0.5f, 1); //Location if (i < 6) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1); y1 = y1 - 1.5f; } else if (5 < i && i < 11) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2); y2 = y2 - 1.5f; } else if (10 < i && i < 16) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3); y3 = y3 - 1.5f; } else if (15 < i && i < 21) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4); y4 = y4 - 1.5f; } } else if (ch_type == "TP") { sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f); //Location if (i < 6) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1); y1 = y1 - 1.5f; } else if (5 < i && i < 11) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2); y2 = y2 - 1.5f; } else if (10 < i && i < 16) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3); y3 = y3 - 1.5f; } else if (15 < i && i < 21) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4); y4 = y4 - 1.5f; } } else if (ch_type == "YM") { sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f); //Location if (i < 6) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1); y1 = y1 - 1.5f; } else if (5 < i && i < 11) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2); y2 = y2 - 1.5f; } else if (10 < i && i < 16) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3); y3 = y3 - 1.5f; } else if (15 < i && i < 21) { ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4); y4 = y4 - 1.5f; } } //Status if (i == 1) { //Child Qty prefab.GetComponent <PlayerHP>().childQty = ch_num; //Child Unit HP prefab.GetComponent <PlayerHP>().childHP = (int)ch_status; StatusGet stsScript = new StatusGet(); int atkDfc = (int)stsScript.getChAtkDfc((int)ch_status, adjHp); //Attack if (ch_type == "YM") { prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 3; } else if (ch_type == "TP") { prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 5; } else { prefab.GetComponent <PlayerAttack> ().attack = prefab.GetComponent <PlayerAttack> ().attack + (ch_num * atkDfc); } //Dfc prefab.GetComponent <PlayerHP> ().dfc = prefab.GetComponent <PlayerHP> ().dfc + (ch_num * atkDfc); } } }