public bool CheckIfSameTeam(NPCInBattlePro NPC1, NPCInBattlePro NPC2) { if (ListMyNPC.Contains(NPC1)) { if (ListMyNPC.Contains(NPC2)) { return(true); } else { return(false); } } else { if (ListMyNPC.Contains(NPC2)) { return(false); } else { return(true); } } }
public string CheckWHatSlotGot(NPCInBattlePro NPC, SlotBattle Slot) // kiem tra slot co gi { if (Slot.CheckNoNPC()) { return("No"); } else { if (CheckIfSameTeam(NPC, Slot.FindNPCInSlot().NPCPro)) { if (NPCNow.GetSlot() == Slot) { return("Self"); } else { return("Ally"); } } else { return("Enemy"); } } }
public void SkipTurn() { for (int i = 0; i < AllNPC.Count; i++) // Xoa nhung NPC Death { if (AllNPC[i].HP <= 0) { Debug.Log(AllNPC[i].Hero.name); TempForTurn.Remove(AllNPC[i]); TempForTurn2.Remove(AllNPC[i]); Temp.Remove(AllNPC[i]); AllNPC.Remove(AllNPC[i]); } } NPCNow.Shade.gameObject.SetActive(false); TurnCount -= 1; if (AllNPC.Any(z => z.TimeSpeed >= 0)) { } else { foreach (var item in AllNPC) { item.TimeSpeed += item.Spd; } } foreach (Transform item in ListTurn.transform) { Destroy(item.gameObject); } NPCInBattlePro A = TempForTurn[0]; TempForTurn[0].TimeSpeed -= MaxSpeedTurn; TempForTurn[0].TurnCount += 1; TempForTurn.Remove(TempForTurn[0]); // Destroy(ListTurn.transform.GetChild(0).gameObject); TempForTurn2 = new List <NPCInBattlePro>(TempForTurn); CheckListTempForTurn(); int b = TempForTurn.IndexOf(TempForTurn.Find(x => x == A)); TempForTurn = new List <NPCInBattlePro>(TempForTurn2); TempForTurn.Insert(b, A); // new Turn guy foreach (NPCInBattlePro item in TempForTurn) { GameObject a = Instantiate(PreTurn, ListTurn.transform); a.GetComponent <TurnCon>().NameNPC.text = item.Hero.name; } ListSlot.transform.GetChild(TempForTurn[0].Index).Find("NPCInbattle(Clone)").GetComponent <NPCInBattle>().WhiteBlink(); NPCNow = ListSlot.transform.GetChild(TempForTurn[0].Index).Find("NPCInbattle(Clone)").GetComponent <NPCInBattle>(); MovePreNPCNow(NPCNow.NPCPro.Hero.Class); BodyMoveIn(); }