public int getHei(int busyoId, int activeBusyoLv, int activeButaiQty, int activeButaiLv) { int hei = 0; StatusGet sts = new StatusGet(); BusyoInfoGet info = new BusyoInfoGet(); string TaisyoType = info.getHeisyu(busyoId); int hp = sts.getHp(busyoId, activeBusyoLv); hp = hp * 100; EnemyInstance enemyIns = new EnemyInstance(); int chldHp = activeButaiQty * enemyIns.getChildStatus(activeButaiLv, TaisyoType, 0); hei = hp + chldHp; return(hei); }
public void makeSimpleEnemy(int busyoId, GameObject battleArea, int xAdjust, GameObject YesBtn) { string path = "Prefabs/Player/" + busyoId; GameObject prefab = Instantiate(Resources.Load(path)) as GameObject; prefab.name = busyoId.ToString(); prefab.transform.SetParent(battleArea.transform); prefab.transform.localScale = new Vector2(-0.4f, 0.6f); prefab.GetComponent <SpriteRenderer>().sortingLayerName = "UI"; prefab.GetComponent <SpriteRenderer>().sortingOrder = 350; /**Player to Enemy**/ prefab.tag = "Enemy"; prefab.layer = LayerMask.NameToLayer("Enemy"); /**Player to Enemy End**/ float xAdjust2 = (float)xAdjust / 5; prefab.transform.localPosition = new Vector2(9 - xAdjust2, 1.8f); prefab.GetComponent <Rigidbody2D>().gravityScale = 1; //Set Scirpt Destroy(prefab.GetComponent <PlayerHP>()); Destroy(prefab.GetComponent <SenpouController>()); Destroy(prefab.GetComponent <LineLocation>()); if (prefab.GetComponent <HomingLong>()) { Destroy(prefab.GetComponent <HomingLong>()); prefab.AddComponent <Homing>(); } if (prefab.GetComponent <AttackLong>()) { Destroy(prefab.GetComponent <AttackLong>()); } else { Destroy(prefab.GetComponent <PlayerAttack>()); } Destroy(prefab.GetComponent <PlayerHP>()); prefab.AddComponent <SimpleAttack>(); prefab.AddComponent <SimpleHP>(); prefab.AddComponent <Homing>(); prefab.GetComponent <Homing>().speed = 50; prefab.GetComponent <Homing>().enabled = false; YesBtn.GetComponent <StartSimpleKassen>().busyoObjList.Add(prefab); //Parametor StartKassen stksn = GameObject.Find("BattleButton").GetComponent <StartKassen>(); int lv = stksn.activeBusyoLv; string busyoString = busyoId.ToString(); StatusGet sts = new StatusGet(); int hp = 100 * sts.getHp(busyoId, lv); int atk = 10 * sts.getAtk(busyoId, lv); int dfc = 10 * sts.getDfc(busyoId, lv); float spd = sts.getSpd(busyoId, lv); //Child Parametor int chlv = stksn.activeButaiLv; int chQty = stksn.activeButaiQty; EnemyInstance enemyInstance = new EnemyInstance(); string ch_type = sts.getHeisyu(busyoId); int ch_status = enemyInstance.getChildStatus(lv, ch_type, 0); int totalChldHp = 0; int totalChldAtk = 0; int totalChldDfc = 0; int atkDfc = (int)sts.getChAtkDfc(ch_status, hp); totalChldHp = ch_status * chQty; totalChldAtk = atkDfc * chQty; totalChldDfc = atkDfc * chQty; //Set value hp = hp + totalChldHp; atk = atk + totalChldAtk; dfc = dfc + totalChldDfc; prefab.GetComponent <Homing>().speed = spd / 20; prefab.GetComponent <SimpleAttack>().atk = atk; prefab.GetComponent <SimpleHP>().dfc = dfc; prefab.GetComponent <SimpleAttack>().baseAtk = atk; prefab.GetComponent <SimpleHP>().baseDfc = dfc; prefab.GetComponent <SimpleHP>().life = hp; }