public void SelectEnd() { if (!batsys.isCard) { ma.AttackAfter(FirstNum); } Seleting = false; batsys.StartCoroutine("AnnounceDisappear"); Image img; img = SommonMonster[0].GetComponent <Image>(); img.color = new Color(1f, 1f, 1f, 1f); img = SommonMonster[1].GetComponent <Image>(); img.color = new Color(1f, 1f, 1f, 1f); img = SommonMonster[2].GetComponent <Image>(); img.color = new Color(1f, 1f, 1f, 1f); img = ab.SommonMonster[0].GetComponent <Image>(); img.color = new Color(1f, 1f, 1f, 1f); img = ab.SommonMonster[1].GetComponent <Image>(); img.color = new Color(1f, 1f, 1f, 1f); img = ab.SommonMonster[2].GetComponent <Image>(); img.color = new Color(1f, 1f, 1f, 1f); }
IEnumerator EnemyAttacks() { yield return(new WaitForSeconds(1f)); if (mobAttackturn <= 2) { if (Sommoned[mobAttackturn] && !State[mobAttackturn].isAttacked) { if (State[mobAttackturn].EnemyType != 5) { for (int i = 0; i >= 0; i++) { int a = Random.Range(0, 2); if (sm.Sommoned[a] && sm.State[a].MobRHP > 0) { sm.Arrows.SetActive(true); sm.Arrows.GetComponent <RectTransform>().localPosition = sm.SommonMonster[a].GetComponent <RectTransform>().localPosition; ma.SpriteChanging(mobAttackturn + 4, State[0].EnemyCode, 2); int dmg = MobDamaging(a, mobAttackturn, State[mobAttackturn].EnemyType); yield return(new WaitForSeconds(0.75f)); ma.AttackAfter(mobAttackturn + 4); sm.Arrows.SetActive(false); if (sm.State[a].MobArmor >= dmg) { sm.State[a].MobArmor -= dmg; GameObject tx = Instantiate(Resources.Load <GameObject>("Prefabs/Effects/DmgText"), transform) as GameObject; tx.transform.parent = GameObject.Find("Canvas").transform; tx.transform.localScale = new Vector3(1f, 1f, 1f); tx.GetComponent <RectTransform>().localPosition = sm.SommonMonster[a].GetComponent <RectTransform>().localPosition; tx.GetComponent <DmgText>().Texting(1, dmg); } else { int dmg2 = dmg - sm.State[a].MobArmor; sm.State[a].MobArmor = 0; sm.State[a].MobRHP -= dmg2; GameObject tx = Instantiate(Resources.Load <GameObject>("Prefabs/Effects/DmgText"), transform) as GameObject; tx.transform.parent = GameObject.Find("Canvas").transform; tx.transform.localScale = new Vector3(1f, 1f, 1f); tx.GetComponent <RectTransform>().localPosition = sm.SommonMonster[a].GetComponent <RectTransform>().localPosition; tx.GetComponent <DmgText>().Texting(1, dmg); } State[mobAttackturn].isAttacked = true; break; } else if (!sm.Sommoned[0] && !sm.Sommoned[1] && !sm.Sommoned[2]) { break; } } } else { int a = 0; float b = 1f; for (int i = 0; i < 3; i++) { if (Sommoned[i]) { float x = State[i].EnemyRHp; float y = State[i].EnemyMaxHP; if (b > x / y) { a = i; b = x / y; } Debug.Log(x + " - " + y); } } sm.Arrows.SetActive(true); sm.Arrows.GetComponent <RectTransform>().localPosition = SommonMonster[a].GetComponent <RectTransform>().localPosition; ma.SpriteChanging(mobAttackturn + 4, State[mobAttackturn].EnemyCode, 2); int dmg = MobDamaging(a, mobAttackturn, State[mobAttackturn].EnemyType); yield return(new WaitForSeconds(0.75f)); ma.AttackAfter(mobAttackturn + 4); sm.Arrows.SetActive(false); State[a].EnemyRHp += dmg; if (State[a].EnemyRHp > State[a].EnemyMaxHP) { State[a].EnemyRHp = State[a].EnemyMaxHP; } GameObject tx = Instantiate(Resources.Load <GameObject>("Prefabs/Effects/DmgText"), transform) as GameObject; tx.transform.parent = GameObject.Find("Canvas").transform; tx.transform.localScale = new Vector3(1f, 1f, 1f); tx.GetComponent <RectTransform>().localPosition = SommonMonster[a].GetComponent <RectTransform>().localPosition; tx.GetComponent <DmgText>().Texting(2, dmg); State[mobAttackturn].isAttacked = true; } } mobAttackturn++; StartCoroutine("EnemyAttacks"); } else { yield return(new WaitForSeconds(0.5f)); batsys.TurnStart(); } }