/// <summary> /// プレイヤーやエネミーたちを作成、最初のリーキャスト /// </summary> public void ReadyBattel() { for (int i = 0; i < PlayerRoot.Instance.p_prefabList.Count; i++) { GameObject player = Instantiate(PlayerRoot.Instance.p_prefabList[i], Vector3.zero, this.transform.rotation) as GameObject; PlayerRoot.Instance.partyList.Add(player); player.transform.parent = this.transform; player.transform.localPosition = posArray[i] * DISTANCE; StartCoroutine("BattelStartRecast", player); player.GetComponentInChildren <Animator> ().SetTrigger("Battel"); JobBase jb = player.GetComponent <JobBase> (); jb.Set_b_Status(BattelStatus.NORMAL); GameObject hp_ui = Instantiate(jb.UI_hp_prefab) as GameObject; hp_ui.transform.SetParent(GameObject.FindGameObjectWithTag("HP_UI").transform); hp_ui.transform.localRotation = Quaternion.Euler(Vector3.zero); hp_ui.transform.localPosition = new Vector3(UI_POS[i], -330, 0); hp_ui.transform.localScale = new Vector3(1.5f, 0.3f, 0); jb.UI_hp = hp_ui.GetComponentInChildren <Slider>(); jb.UI_hp.maxValue = jb._maxHP; jb.UI_hp.value = jb._hp; } //if (PlayerRoot.Instance.battelEnemyList.Count == 0) if (PlayerRoot.Instance.battelEnemyList.Count > 0) { EnemyPrefabList = PlayerRoot.Instance.battelEnemyList; PlayerRoot.Instance.battelEnemyList = new List <GameObject>(); } else { string ed = GetEnemyData("Enemy_Set.json"); GetEnemyPerfabs(ed); } for (int i = 0; i < EnemyPrefabList.Count; i++) { GameObject enemy = Instantiate(EnemyPrefabList[i], Vector3.zero, this.transform.rotation) as GameObject; PlayerRoot.Instance.enemyList.Add(enemy); enemy.transform.parent = enemyRoot; enemy.transform.localPosition = posArray[i] * DISTANCE; EnemyBase eb = enemy.GetComponent <EnemyBase>(); GameObject hp_ui = Instantiate(eb.UI_hp_prefab) as GameObject; hp_ui.transform.SetParent(GameObject.FindGameObjectWithTag("HP_UI").transform); hp_ui.transform.localRotation = Quaternion.Euler(Vector3.zero); hp_ui.transform.localPosition = new Vector3(550, E_UI_POS[i], 0); hp_ui.transform.localScale = new Vector3(1.5f, 0.3f, 0); eb.UI_hp = hp_ui.GetComponentInChildren <Slider>(); eb.UI_hp.maxValue = eb._maxHP; eb.UI_hp.value = eb._hp; } enemyRoot.rotation = Quaternion.Euler(0, 180, 0); }
/// <summary> /// 子供を生成する /// </summary> public GameObject CreateObject(string name, GameObject obj) { GameObject player = Instantiate(obj, this.transform.position, this.transform.rotation) as GameObject; player.name = name; player.AddComponent <SphereCollider> (); SphereCollider sc = player.GetComponent <SphereCollider> (); sc.center = new Vector3(0, 0.5f, 0); sc.radius = 1.5f; sc.isTrigger = true; p_jb = player.GetComponent <JobBase>(); p_jb.Set_b_Status(BattelStatus.NOT_IN_BATTEL); return(player); }