public void viewKuniLink(GameObject board, GameObject kuniMap, List <string> seiryokuList) { KuniInfo kuniScript = new KuniInfo(); List <int> linkKuniList = kuniScript.getMappingKuni(kuniId); List <int> linkAllKuniList = new List <int>(); for (int i = 0; i < linkKuniList.Count; i++) { int linkKuniId = linkKuniList[i]; linkAllKuniList.Add(linkKuniId); } //view kuni arrow link Daimyo daimyoScript = new Daimyo(); for (int i = 0; i < linkAllKuniList.Count; i++) { int srcKuniId = linkAllKuniList[i]; List <int> XYList = kuniScript.getLinkStageXY(srcKuniId, kuniId); string pathOfSrcKuni = "Prefabs/Map/Stage/ArrowKuniName"; GameObject srcKuniNameObj = Instantiate(Resources.Load(pathOfSrcKuni)) as GameObject; srcKuniNameObj.name = "Arrow" + srcKuniId; srcKuniNameObj.transform.SetParent(board.transform.FindChild("board").transform); srcKuniNameObj.transform.localScale = new Vector2(0.1f, 0.15f); srcKuniNameObj.transform.localPosition = new Vector2(XYList[0], XYList[1]); srcKuniNameObj.GetComponent <Text>().text = kuniScript.getKuniName(srcKuniId); string linkStage = kuniScript.getLinkStage(srcKuniId, kuniId); linkStage = linkStage.Replace("stage", ""); List <int> linkStageList = new List <int>(Array.ConvertAll(linkStage.Split(','), new Converter <string, int>((s) => { return(Convert.ToInt32(s)); }))); string arrowDaimyoPath = "Prefabs/Map/Stage/ArrowDaimyo"; GameObject arrowDaimyo = Instantiate(Resources.Load(arrowDaimyoPath)) as GameObject; arrowDaimyo.transform.SetParent(srcKuniNameObj.transform); arrowDaimyo.transform.localScale = new Vector2(8, 7); arrowDaimyo.transform.localPosition = new Vector2(0, 0); arrowDaimyo.transform.FindChild("Effect").GetComponent <DamagePop>().divSpeed = 5; arrowDaimyo.transform.FindChild("Effect").GetComponent <DamagePop>().attackBoardflg = true; int arrowDaimyoId = int.Parse(seiryokuList[srcKuniId - 1]); string daimyoName = daimyoScript.getName(arrowDaimyoId); arrowDaimyo.transform.FindChild("Effect").GetComponent <Text>().text = daimyoName; arrowDaimyo.transform.FindChild("Effect").transform.localScale = new Vector2(0.12f, 0.12f); string kamonPath = "Prefabs/Kamon/MyDaimyoKamon/" + arrowDaimyoId.ToString(); arrowDaimyo.GetComponent <Image>().sprite = Resources.Load(kamonPath, typeof(Sprite)) as Sprite; //Arrow string arrowPath = "Prefabs/PostKassen/Arrow"; for (int j = 0; j < linkStageList.Count; j++) { GameObject arrow = Instantiate(Resources.Load(arrowPath)) as GameObject; arrow.transform.SetParent(srcKuniNameObj.transform); arrow.transform.localScale = new Vector2(200, 200); arrow.transform.localPosition = new Vector2(0, 0); string stageId = "stage" + linkStageList[j]; GameObject tgtStageObj = kuniMap.transform.FindChild(stageId).gameObject; Vector3 posDif = tgtStageObj.transform.position - arrow.transform.position; float angle = Mathf.Atan2(posDif.y, posDif.x) * Mathf.Rad2Deg; Vector3 euler = new Vector3(0, 0, angle); arrow.transform.rotation = Quaternion.Euler(euler); } } }