public void AttackNormal() { FieldBattle(); int a = HoverSlot.FindNPCInSlot().NPCPro.HP; int b = NPCNow.NPCPro.HP; HoverSlot.FindNPCInSlot().NPCPro.HP -= (int)((((float)NPCNow.NPCPro.Att + 1) / (HoverSlot.FindNPCInSlot().NPCPro.Def + 1)) * b / 10); NPCNow.NPCPro.HP -= (int)((((float)HoverSlot.FindNPCInSlot().NPCPro.Att + 1) / (NPCNow.NPCPro.Def + 1)) * a / 10); SkipTurn(); MovePreNPCNow(NPCNow.NPCPro.Hero.Class); }
public void AttackRange() { FieldBattle(); // Field.SetActive(true); int a = HoverSlot.FindNPCInSlot().NPCPro.HP; int b = NPCNow.NPCPro.HP; HoverSlot.FindNPCInSlot().NPCPro.HP -= (int)((((float)NPCNow.NPCPro.Att + 1) / (HoverSlot.FindNPCInSlot().NPCPro.Def + 1)) * b / 10); SkipTurn(); MovePreNPCNow(NPCNow.NPCPro.Hero.Class); }
public IEnumerator ForFieldBattle() { StartCoroutine(TurnOnandOffObjectAfterSec(BlackBlock, 0, 3)); StartCoroutine(TurnOnandOffObjectAfterSec(Field, 0, 3)); StartCoroutine(TurnOnandOffObjectAfterSec(NPCdetailbatlle, 0, 3)); if (CheckIfNPCIsPlayer()) { FieldDetail.P1Pic.sprite = NPCNow.NPCPro.Hero.BattleBody; FieldDetail.P2Pic.sprite = HoverSlot.FindNPCInSlot().NPCPro.Hero.BattleBody; FieldDetail.P1name.text = NPCNow.NPCPro.Hero.name.ToString(); FieldDetail.P2name.text = HoverSlot.FindNPCInSlot().NPCPro.Hero.name.ToString(); FieldDetail.P1HP.text = NPCNow.NPCPro.HP.ToString(); FieldDetail.P2HP.text = HoverSlot.FindNPCInSlot().NPCPro.HP.ToString(); yield return(new WaitForSeconds(1)); GameObject a = Instantiate(AttackPartical, Field.transform); foreach (Transform item in ListP2Troop.transform) //shake { item.transform.GetComponent <ShakingClass>().ShakeMe(5); } } else { FieldDetail.P2Pic.sprite = NPCNow.NPCPro.Hero.BattleBody; FieldDetail.P1Pic.sprite = HoverSlot.FindNPCInSlot().NPCPro.Hero.BattleBody; FieldDetail.P2name.text = NPCNow.NPCPro.Hero.name.ToString(); FieldDetail.P1name.text = HoverSlot.FindNPCInSlot().NPCPro.Hero.name.ToString(); FieldDetail.P2HP.text = NPCNow.NPCPro.HP.ToString(); FieldDetail.P1HP.text = HoverSlot.FindNPCInSlot().NPCPro.HP.ToString(); yield return(new WaitForSeconds(1)); GameObject a = Instantiate(AttackPartical, Field.transform); a.transform.localScale = new Vector3(-a.transform.localScale.x, a.transform.localScale.y, a.transform.localScale.z); foreach (Transform child in a.transform) { child.GetComponent <ParticleSystemRenderer>().flip = new Vector3(1, 0, 0); } foreach (Transform item in ListP1Troop.transform) //shake { item.transform.GetComponent <ShakingClass>().ShakeMe(5); } } }